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, 7 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
-
June 2025 updates are out
by
Susan Bradley
57 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
4 hours, 21 minutes ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
4 hours, 25 minutes ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
6 hours, 54 minutes ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
6 hours, 55 minutes ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
6 hours, 53 minutes ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
4 hours, 47 minutes ago -
re-install Windows Security
by
CWBillow
10 hours, 10 minutes ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
13 hours, 51 minutes ago -
macOS Tahoe 26
by
Alex5723
8 hours, 4 minutes ago -
Migrating from win10 to win11, instructions coming?
by
astro46
2 hours, 21 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
14 hours, 37 minutes ago -
Recommended watching : Mountainhead movie
by
Alex5723
1 minute ago -
End of support for Windows 10
by
Old enough to know better
50 minutes ago -
What goes on inside an LLM
by
Michael Covington
4 hours, 1 minute ago -
The risk of remote access
by
Susan Bradley
2 hours, 16 minutes ago -
The cruelest month for many Office users
by
Peter Deegan
5 hours, 33 minutes ago -
Tracking protection and trade-offs in Edge
by
Mary Branscombe
3 hours, 35 minutes ago -
Supreme Court grants DOGE access to confidential Social Security records
by
Alex5723
1 day, 12 hours ago -
EaseUS Partition Master free 19.6
by
Alex5723
12 hours, 52 minutes ago -
Microsoft : Edge is better than Chrome
by
Alex5723
2 days, 1 hour ago -
The EU launched DNS4EU
by
Alex5723
2 days, 14 hours ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
2 days, 4 hours ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
2 days, 19 hours ago -
Set default size for pasted photo to word
by
Cyn
3 days, 1 hour ago -
Dedoimedo tries 24H2…
by
Cybertooth
2 days, 13 hours ago -
Windows 11 Insider Preview build 27871 released to Canary
by
joep517
4 days ago -
Windows 11 ad from Campaign Manager in Windows 10
by
Jim McKenna
1 day, 17 hours ago -
Small desktops
by
Susan Bradley
5 hours, 6 minutes ago -
Totally disable Bitlocker
by
CWBillow
2 days, 18 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.