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
-
Win 11 24H2 June 2025 Update breaks WIFI
by
dportenlanger
3 hours, 16 minutes ago -
Update from WinPro 10 v. 1511 on T460p?
by
CatoRenasci
34 minutes ago -
System Restore and Updates Paused
by
veteran
5 hours, 47 minutes ago -
Windows 10/11 clock app
by
Kathy Stevens
2 hours, 3 minutes ago -
Turn off right-click draw
by
Charles Billow
9 hours, 1 minute ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
12 hours, 32 minutes ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
1 hour, 35 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
14 hours, 8 minutes ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
6 hours, 10 minutes ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
20 hours, 10 minutes ago -
KB5060842 Issue (Minor)
by
AC641
1 day ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
1 day, 3 hours ago -
24H2 may not be offered June updates
by
Susan Bradley
1 hour, 53 minutes ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
1 day, 15 hours ago -
June 2025 updates are out
by
Susan Bradley
4 hours, 7 minutes ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
2 days, 6 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
1 day, 15 hours ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
2 days, 9 hours ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
2 days, 9 hours ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
2 days, 9 hours ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
2 days, 1 hour ago -
re-install Windows Security
by
CWBillow
2 days, 12 hours ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
2 days, 16 hours ago -
macOS Tahoe 26
by
Alex5723
2 days, 10 hours ago -
Migrating from win10 to win11, instructions coming?
by
astro46
59 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
2 days ago -
Recommended watching : Mountainhead movie
by
Alex5723
2 days, 1 hour ago -
End of support for Windows 10
by
Old enough to know better
23 minutes ago -
What goes on inside an LLM
by
Michael Covington
1 hour, 20 minutes ago -
The risk of remote access
by
Susan Bradley
23 minutes 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.