Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That means they must not actually be blank. Do you have formulas in them
(not blank). Or did you clear them by hitting the spacebar (not blank). I ran it on a sheet that actually had blank cells in column A and it worked perfectly. Guess you will have to clean up your data or go with Markus's code. -- Regards, Tom Ogilvy "Michael Koerner" wrote in message ... Tom I tried your macro, and all I got was the message "No blank Cells -- Regards Michael Koerner "Tom Ogilvy" wrote in message ... or, if the cells are really empty/blank, a quicker approach would be Sub ABCD() dim cell as Range On Error Resume Next for each cell in Activesheet.columns(1).Specialcells(xlBlanks) cell.Value = Cell.offset(0,1).Value ' uncomment the next line if you want ' the value in B cleared 'cell.Offset(0,1).ClearContents Next if err < 0 then msgbox "No Blank Cells err.clear End if End Sub -- Regards, Tom Ogilvy "Markus Scheible" wrote in message ... Hi Michael, try: For i = 1 To 65532 If Range("a" & i).Value = "" Then Range("a" & i).Value = Range("b" & i) End If Next i Best Markus -----Original Message----- I need to move the data from Col B to Col A only if the cell in Col A is empty. Is there an easy way to do this? -- Regards Michael Koerner . |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your absolutely correct. Once I cleared the contents of the supposedly blank
cells your macro worked as advertised. Which is good, as I wouldn't know how to use Markus's code <g -- Regards Michael Koerner "Tom Ogilvy" wrote in message ... That means they must not actually be blank. Do you have formulas in them (not blank). Or did you clear them by hitting the spacebar (not blank). I ran it on a sheet that actually had blank cells in column A and it worked perfectly. Guess you will have to clean up your data or go with Markus's code. -- Regards, Tom Ogilvy "Michael Koerner" wrote in message ... Tom I tried your macro, and all I got was the message "No blank Cells -- Regards Michael Koerner "Tom Ogilvy" wrote in message ... or, if the cells are really empty/blank, a quicker approach would be Sub ABCD() dim cell as Range On Error Resume Next for each cell in Activesheet.columns(1).Specialcells(xlBlanks) cell.Value = Cell.offset(0,1).Value ' uncomment the next line if you want ' the value in B cleared 'cell.Offset(0,1).ClearContents Next if err < 0 then msgbox "No Blank Cells err.clear End if End Sub -- Regards, Tom Ogilvy "Markus Scheible" wrote in message ... Hi Michael, try: For i = 1 To 65532 If Range("a" & i).Value = "" Then Range("a" & i).Value = Range("b" & i) End If Next i Best Markus -----Original Message----- I need to move the data from Col B to Col A only if the cell in Col A is empty. Is there an easy way to do this? -- Regards Michael Koerner . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Moving a line chart data point revises data table value in Excel ' | Charts and Charting in Excel | |||
Moving Data between sheets in the same workbook and moving data between Workbooks. | Excel Worksheet Functions | |||
Moving data from one worksheet to another whilst removing the data | Excel Discussion (Misc queries) | |||
moving data to non autofarmatted book changes data- Why? | Excel Discussion (Misc queries) | |||
moving data in excel without deleting existing data | Excel Discussion (Misc queries) |