View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman Mike Fogleman is offline
external usenet poster
 
Posts: 1,092
Default Macro code to check & copy columns

This seems to work according to your description:

Sub CopyData()
Dim lRow As Long
Dim rng As Range
Dim c As Range

lRow = Cells(Rows.Count, "B").End(xlUp).Row
Set rng = Range("B1:B" & lRow)

For Each c In rng.Cells
If c.Offset(, 26).Value < "" _
And c.Offset(, 25).Value = "" Then
c.Offset(, 25).Value = c.Value
End If
Next c
End Sub

Mike F
"mercedes" wrote in
message ...

Hello!
I need some help with a macro code. I'm a beginner who doesn't know
quite how to do begin. I have records in rows in an Excel spread sheet,
I need code that would check each record to see if data is present in
column AB cell. If AB is NOT blank, I need it to check if column AA
cell is blank. If it is blank, I need it to copy the data from column B
cell to column AA cell...again only if column AB is not blank and AA is
blank. Whew! Hope that made sense. Thanks in advance for all your help.


--
mercedes
------------------------------------------------------------------------
mercedes's Profile:
http://www.excelforum.com/member.php...o&userid=24979
View this thread: http://www.excelforum.com/showthread...hreadid=473634