Mourning the loss of our friend, WhitPhil.
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Business Applications
Tag Cloud
access audio blue screen boot bsod connection crash dell desktop driver dvd email error excel excel 2003 firefox hard drive hardware hijackthis internet keyboard laptop malware monitor motherboard network networking outlook problem processor ram recovery router screen slow sound spyware tdlwsp.dll trojan upgrade vba video virus vista vundo windows windows 7 windows vista windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Search & Decide excel macro

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

 
Thread Tools
kamio23's Avatar
Computer Specs
Junior Member with 2 posts.
 
Join Date: Nov 2009
Experience: Intermediate
04-Nov-2009, 12:39 PM #1
Solved: Search & Decide excel macro
Hi, I need help with a search macro for excel. I need to search coulmn B for a number (all types - integer, decimal) then if that is found check column A (in the same row) to see if it is blank. If it is blank I need to put an 'x' in that corresponding cell in column A. Here's an example:

col A col B
r1 ____ 3.25
r2 text 10
r3 ____ text
r4 ____ 8

It doesn't line up perfect but you get the point. So here the macro needs to put an 'x' in A1 & A4.

In addition, I have another macro I'm using to return a value for the last row called 'myLastRow'. I want to use this variable in a For statement to have the search & decide macro know when to stop looking in column B since the data changes from scenario to scenario.

Thanks for your help in advance!
Rollin_Again's Avatar
Distinguished Member with 3,728 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Brilliant When Sober
04-Nov-2009, 05:51 PM #2
Try the macro below. Just change the portion highlighted in red to reflect the first cell in column B to check.

Code:
Sub FindNumbers()

For Each vCell In Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row).Cells

If Not IsEmpty(vCell) And IsNumeric(vCell) Then

If vCell.Offset(0,-1).Value = "" Then

vCell.Offset(0, -1).Value = "X"

End If

End If

Next vCell

End Sub
Regards,
Rollin

Last edited by Rollin_Again : 04-Nov-2009 08:40 PM.
kamio23's Avatar
Computer Specs
Junior Member with 2 posts.
 
Join Date: Nov 2009
Experience: Intermediate
05-Nov-2009, 03:59 PM #3
Talking Thank you!
Rollin,
This worked perfect! Thank you soooo much!!!
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 4,511 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
05-Nov-2009, 10:45 PM #4
kamio23, can you mark your thread as solved?
Reply Bookmark and Share

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 11:55 AM.
Copyright © 1996 - 2009 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.