LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 4
Default Check for values in column A and if found then column B must have value.

Hello everybody.

I have a macro that checks for column A2 to A12 and if data is found (text) the column B2 to B12 must have a numeric value.

In other words, if A2 has got text then B2 must have a numeric value and so on, if not stop macro.

There is the following code;

for each cel in range("a:a")
if isempty(cel) then exit for ' finish on empty cell
if isempty(cel.offset(,1)) then cel.offset(,1).value = msgbox("enter a quantity for " & cel)
next

there is one issue.

The macro is returning the error when finding a row with text and no value on same line for column B but when I click OK it sends a 1 to the empty field.

Can I have the focus set to the next empty cell please?

If possible when error found either focus on the empty cell or a msgBox asking for the quantity and having it filling it up as going through all the lines. Thank you.

I must say I thought this to be the most complicated code of all I have but is quite simple or I mean a few lines and its doing waht I though to be many lines of code.

Thank you.
Albert
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check values in each column Martin Excel Programming 4 November 22nd 09 07:08 AM
Subtotals of Items in A Column based on Spec. Values found in Colu Brad Excel Discussion (Misc queries) 1 November 17th 08 03:59 PM
Loop through column(s) to check values, perform action based on check ward376 Excel Programming 4 November 6th 07 03:21 PM
Search Column, If match found then add two values. [email protected] Excel Programming 2 March 21st 07 09:33 AM
URGENT -- search in string for a value in another column, if found, return value from next column samkshah Excel Programming 4 October 3rd 05 04:13 PM


All times are GMT +1. The time now is 09:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"