Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Business Applications
Tag Cloud
access acer asus bios bsod computer crash drive driver drivers error ethernet excel freeze games gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard netgear network printer problem ram random registry router slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless xbox
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Business Applications >
Solved: Search & Decide excel macro

Reply  
Thread Tools
kamio23's Avatar
Computer Specs
Junior Member with 2 posts.
 
Join Date: Nov 2009
Experience: Intermediate
04-Nov-2009, 01: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
Senior Member with 4,273 posts.
 
Join Date: Sep 2003
Location: Atlanta, GA - Planet Earth
Experience: Brilliant When Sober
04-Nov-2009, 06: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 at 09:40 PM..
kamio23's Avatar
Computer Specs
Junior Member with 2 posts.
 
Join Date: Nov 2009
Experience: Intermediate
05-Nov-2009, 04:59 PM #3
Talking Thank you!
Rollin,
This worked perfect! Thank you soooo much!!!
Zack Barresse's Avatar
Computer Specs
Distinguished Member with 5,030 posts.
 
Join Date: Jul 2004
Location: Oregon, United States
Experience: I'ma learnin'!
05-Nov-2009, 11:45 PM #4
kamio23, can you mark your thread as solved?
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




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



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 04:38 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.