locate and copy macro needed

acemecca

New Member
Joined
Sep 14, 2011
Messages
19
greetings:

i have a spreadsheet where i need to copy a cell and enter the same contents in the cell above it (all in the same column) ONLY if there is a blank above the data

for example: i have data in cell 'J4"....i need the macro to find the blanks in column J (which is J3) and paste the item in the blank...

it should repeat through the column...

please advise!
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
try this...you will need to enter the column number in the input box....

Sub test()
Dim i As Integer
i = InputBox("Enter the column number in numeric")
eRow = Cells(Rows.Count, i).End(xlUp).Row
Cells(1, i).Select
Do
If ActiveCell.Value = "" Then
ActiveCell.Value = ActiveCell.Offset(1, 0).Value
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Row = eRow
End Sub
 
Upvote 0
thanks a lot...will try it now and will come back if i have any issues....u guys are a timesaver...thanks again!
 
Upvote 0

Forum statistics

Threads
1,224,547
Messages
6,179,436
Members
452,915
Latest member
hannnahheileen

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