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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,223,767
Messages
6,174,395
Members
452,561
Latest member
amir5104

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