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
-
Installer program can’t read my registry
by
Peobody
12 minutes ago -
How to keep Outlook (new) in off position for Windows 11
by
EspressoWillie
12 hours, 27 minutes ago -
Intel : CVE-2024-45332, CVE-2024-43420, CVE-2025-20623
by
Alex5723
10 hours, 11 minutes ago -
False error message from eMClient
by
WSSebastian42
10 hours, 5 minutes ago -
Awoke to a rebooted Mac (crashed?)
by
rebop2020
19 hours, 10 minutes ago -
Office 2021 Perpetual for Mac
by
rebop2020
20 hours, 22 minutes ago -
AutoSave is for Microsoft, not for you
by
Will Fastie
4 hours, 36 minutes ago -
Difface : Reconstruction of 3D Human Facial Images from DNA Sequence
by
Alex5723
23 hours, 54 minutes ago -
Seven things we learned from WhatsApp vs. NSO Group spyware lawsuit
by
Alex5723
56 minutes ago -
Outdated Laptop
by
jdamkeene
1 day, 5 hours ago -
Updating Keepass2Android
by
CBFPD-Chief115
1 day, 10 hours ago -
Another big Microsoft layoff
by
Charlie
1 day, 10 hours ago -
PowerShell to detect NPU – Testers Needed
by
RetiredGeek
13 hours, 50 minutes ago -
May 2025 updates are out
by
Susan Bradley
3 hours, 28 minutes ago -
Windows 11 Insider Preview build 26200.5600 released to DEV
by
joep517
1 day, 16 hours ago -
Windows 11 Insider Preview build 26120.3964 (24H2) released to BETA
by
joep517
1 day, 16 hours ago -
Drivers suggested via Windows Update
by
Tex265
1 day, 16 hours ago -
Thunderbird release notes for 128 esr have disappeared
by
EricB
1 day, 14 hours ago -
CISA mutes own website, shifts routine cyber alerts to X, RSS, email
by
Nibbled To Death By Ducks
1 day, 23 hours ago -
Apple releases 18.5
by
Susan Bradley
1 day, 17 hours ago -
Fedora Linux 40 will go end of life for updates and support on 2025-05-13.
by
Alex5723
2 days ago -
How a new type of AI is helping police skirt facial recognition bans
by
Alex5723
2 days, 1 hour ago -
Windows 7 ISO /Windows 10 ISO
by
ECWS
9 hours, 48 minutes ago -
No HP software folders
by
fpefpe
2 days, 9 hours ago -
Which antivirus apps and VPNs are the most secure in 2025?
by
B. Livingston
1 day, 6 hours ago -
Stay connected anywhere
by
Peter Deegan
2 days, 14 hours ago -
Copilot, under the table
by
Will Fastie
16 hours, 53 minutes ago -
The Windows experience
by
Will Fastie
2 days, 20 hours ago -
A tale of two operating systems
by
Susan Bradley
1 day ago -
Microsoft : Resolving Blue Screen errors in Windows
by
Alex5723
3 days, 2 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.