hi. i would like to create 2 codes here. one is IF cell II4>II8, then the active cell is in IE1 if not place the active cell in IC11. another code is place the active cell below a cell that has * mark (or any mark i can modify mine subject to vba code convenient) in a range of cell given . that’s all. Please help. Thanks.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
2 small vba codes (excel 2002)
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » 2 small vba codes (excel 2002)
- This topic has 20 replies, 2 voices, and was last updated 20 years, 6 months ago.
Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody LoungerNovember 4, 2004 at 9:32 am #895427First question:
Sub SelectACell()
If Range(“II4”) > Range(“II8”) Then
Range(“IE1”).Select
Else
Range(“IC11″).Select
End If
End SubSecond question:
Sub SelectBelowMark(oRange As Range, strMark As String)
Dim oCell As Range
Set oCell = oRange.Find(What:=”~” & strMark)
If Not oCell Is Nothing Then
oCell.Offset(1, 0).Select
End If
End SubCall it like this:
SelectBelowMark Range(“A1:E4”), “*”
-
WSboat
AskWoody LoungerNovember 6, 2004 at 4:03 am #896361hi Hans, the first solution works perfect. THANKS. i don’t know how to use the second code, about this code,
Sub SelectBelowMark(oRange As Range, strMark As String)
Dim oCell As Range
Set oCell = oRange.Find(What:=”~” & strMark)
If Not oCell Is Nothing Then
oCell.Offset(1, 0).Select
End If
End Subwhere to put the SelectBelowMark Range(“A1:E4”), “*” in your code, or to make it run??
sorry for my illiterate. -
WSHansV
AskWoody Lounger -
WSboat
AskWoody Lounger -
WSHansV
AskWoody LoungerNovember 8, 2004 at 8:03 am #896897Make sure that you have copied the SelectBelowMark procedure into a module. Then enter the following code into the same module:
Sub SelectNow()
SelectBelowMark Range(“A11:Z11”), “*”
End SubWhen you run this macro, it will select the cell below the one in A11:Z11 that contains an asterisk *. If you want to select a cell below a cell in B10:N10 that contains an @, use
Sub SelectNow()
SelectBelowMark Range(“B10:N10”), “@”
End Subetc.
-
WSboat
AskWoody Lounger -
WSboat
AskWoody Lounger -
WSboat
AskWoody LoungerNovember 8, 2004 at 2:18 pm #896997hi. this macro is i think extension of the code you provided above although i use it differently. Thanks. because i will run another macro after above code. and this will it after that macro. can you help me here??,, Thanks.
Create a new macro, of 4 cells involved, no matter where they are: on an active cell, go up one cell, then delete the * mark (or whatever mark, use * in this e.g.) go one cell to the right, place the same mark (place * mark there) and finally the active cell is below the new * mark. i tried record macro but that will remain fix selected range and my intention is to make it placing new mark to the right of original mark and deleting original mark whenever there is a mark exists within a range. Thank you.
-
WSHansV
AskWoody LoungerNovember 8, 2004 at 2:38 pm #897011Try this:
Sub MoveToTheRight()
With ActiveCell
.Offset(-1, 1) = .Offset(-1, 0)
.Offset(-1, 0).ClearContents
.Offset(0, 1).Select
End With
End SubIf you follow what this macro does, you will learn how to work with relative offsets to a cell (in this case, to the active cell). The two arguments to Offset are the RowOffset first, then the ColumnOffset.
-
WSboat
AskWoody LoungerNovember 8, 2004 at 4:13 pm #897063Hi Hans. Thanks for your code and quick reply. i learn that it is clearcut to follow two items below about the 2 arguments of Offset: RowOffset first, then the ColumnOffset.
.Offset(-1, 0).ClearContents
.Offset(0, 1).Selectbut not this one:
.Offset(-1, 1) = .Offset(-1, 0)
that will shift the * mark from original place to right and place active cell in its original active cell.
but having known this function is good as well for my other related purpose maybe. Thanks again. -
WSHansV
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSboat
AskWoody LoungerNovember 8, 2004 at 4:13 pm #897064Hi Hans. Thanks for your code and quick reply. i learn that it is clearcut to follow two items below about the 2 arguments of Offset: RowOffset first, then the ColumnOffset.
.Offset(-1, 0).ClearContents
.Offset(0, 1).Selectbut not this one:
.Offset(-1, 1) = .Offset(-1, 0)
that will shift the * mark from original place to right and place active cell in its original active cell.
but having known this function is good as well for my other related purpose maybe. Thanks again. -
WSHansV
AskWoody LoungerNovember 8, 2004 at 2:38 pm #897012Try this:
Sub MoveToTheRight()
With ActiveCell
.Offset(-1, 1) = .Offset(-1, 0)
.Offset(-1, 0).ClearContents
.Offset(0, 1).Select
End With
End SubIf you follow what this macro does, you will learn how to work with relative offsets to a cell (in this case, to the active cell). The two arguments to Offset are the RowOffset first, then the ColumnOffset.
-
WSboat
AskWoody LoungerNovember 8, 2004 at 2:18 pm #896998hi. this macro is i think extension of the code you provided above although i use it differently. Thanks. because i will run another macro after above code. and this will it after that macro. can you help me here??,, Thanks.
Create a new macro, of 4 cells involved, no matter where they are: on an active cell, go up one cell, then delete the * mark (or whatever mark, use * in this e.g.) go one cell to the right, place the same mark (place * mark there) and finally the active cell is below the new * mark. i tried record macro but that will remain fix selected range and my intention is to make it placing new mark to the right of original mark and deleting original mark whenever there is a mark exists within a range. Thank you.
-
WSHansV
AskWoody LoungerNovember 8, 2004 at 8:03 am #896898Make sure that you have copied the SelectBelowMark procedure into a module. Then enter the following code into the same module:
Sub SelectNow()
SelectBelowMark Range(“A11:Z11”), “*”
End SubWhen you run this macro, it will select the cell below the one in A11:Z11 that contains an asterisk *. If you want to select a cell below a cell in B10:N10 that contains an @, use
Sub SelectNow()
SelectBelowMark Range(“B10:N10”), “@”
End Subetc.
-
-
WSboat
AskWoody Lounger
-
-
WSHansV
AskWoody Lounger
-
-
WSboat
AskWoody LoungerNovember 6, 2004 at 4:03 am #896362hi Hans, the first solution works perfect. THANKS. i don’t know how to use the second code, about this code,
Sub SelectBelowMark(oRange As Range, strMark As String)
Dim oCell As Range
Set oCell = oRange.Find(What:=”~” & strMark)
If Not oCell Is Nothing Then
oCell.Offset(1, 0).Select
End If
End Subwhere to put the SelectBelowMark Range(“A1:E4”), “*” in your code, or to make it run??
sorry for my illiterate.
-
-
WSHansV
AskWoody LoungerNovember 4, 2004 at 9:32 am #895428First question:
Sub SelectACell()
If Range(“II4”) > Range(“II8”) Then
Range(“IE1”).Select
Else
Range(“IC11″).Select
End If
End SubSecond question:
Sub SelectBelowMark(oRange As Range, strMark As String)
Dim oCell As Range
Set oCell = oRange.Find(What:=”~” & strMark)
If Not oCell Is Nothing Then
oCell.Offset(1, 0).Select
End If
End SubCall it like this:
SelectBelowMark Range(“A1:E4”), “*”
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
hibernate activation
by
e_belmont
2 hours, 39 minutes ago -
Red Hat Enterprise Linux 10 with AI assistant
by
Alex5723
2 hours, 57 minutes ago -
Windows 11 Insider Preview build 26200.5603 released to DEV
by
joep517
6 hours, 1 minute ago -
Windows 11 Insider Preview build 26120.4151 (24H2) released to BETA
by
joep517
6 hours, 3 minutes ago -
Fixing Windows 24H2 failed KB5058411 install
by
Alex5723
9 hours, 13 minutes ago -
Out of band for Windows 10
by
Susan Bradley
10 hours, 46 minutes ago -
Giving UniGetUi a test run.
by
RetiredGeek
17 hours, 44 minutes ago -
Windows 11 Insider Preview Build 26100.4188 (24H2) released to Release Preview
by
joep517
1 day, 1 hour ago -
Microsoft is now putting quantum encryption in Windows builds
by
Alex5723
23 hours, 19 minutes ago -
Auto Time Zone Adjustment
by
wadeer
1 day, 5 hours ago -
To download Win 11 Pro 23H2 ISO.
by
Eddieloh
1 day, 3 hours ago -
Manage your browsing experience with Edge
by
Mary Branscombe
8 hours, 5 minutes ago -
Fewer vulnerabilities, larger updates
by
Susan Bradley
19 hours, 1 minute ago -
Hobbies — There’s free software for that!
by
Deanna McElveen
2 hours, 55 minutes ago -
Apps included with macOS
by
Will Fastie
47 minutes ago -
Xfinity home internet
by
MrJimPhelps
22 hours, 51 minutes ago -
Convert PowerPoint presentation to Impress
by
RetiredGeek
22 hours, 49 minutes ago -
Debian 12.11 released
by
Alex5723
2 days, 2 hours ago -
Microsoft: Troubleshoot problems updating Windows
by
Alex5723
2 days, 6 hours ago -
Woman Files for Divorce After ChatGPT “Reads” Husband’s Coffee Cup
by
Alex5723
1 day, 10 hours ago -
Moving fwd, Win 11 Pro,, which is best? Lenovo refurb
by
Deo
2 hours, 43 minutes ago -
DBOS Advanced Network Analysis
by
Kathy Stevens
2 days, 23 hours ago -
Microsoft Edge Launching Automatically?
by
healeyinpa
2 days, 14 hours ago -
Google Chrome to block admin-level browser launches for better security
by
Alex5723
11 hours, 42 minutes ago -
iPhone SE2 Stolen Device Protection
by
Rick Corbett
2 days, 18 hours ago -
Some advice for managing my wireless internet gateway
by
LHiggins
2 days, 2 hours ago -
NO POWER IN KEYBOARD OR MOUSE
by
HE48AEEXX77WEN4Edbtm
1 day, 4 hours ago -
A CVE-MITRE-CISA-CNA Extravaganza
by
Nibbled To Death By Ducks
3 days, 11 hours ago -
Sometimes I wonder about these bots
by
Susan Bradley
23 hours, 51 minutes ago -
Does windows update component store “self heal”?
by
Mike Cross
2 days, 22 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.