Skip blank cells in macro

seho22

New Member
Joined
Sep 21, 2015
Messages
2
Hi,
My data like this:

some text
some text
some text
value1


-empty cell -


some text
some text
some text
value2

My expectations of the macro is:
1. start from down to up.
2. copy value2 to three cells and stop while on empty cell
3. copy value1 to three cells

Finally my data should be like this:

value1
value1
value1
value1


-empty cell -


value2
value2
value2
value2


Thanks and sorry for my bad english :(
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I think this macro will do what you want...
Code:
Sub CopyValuesUp()
  Dim Ar As Range
  On Error GoTo NoData
  For Each Ar In Columns("A").SpecialCells(xlConstants).Areas
    Ar(Ar.Count).Copy Ar
  Next
NoData:
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,206
Messages
6,123,636
Members
449,109
Latest member
Sebas8956

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top