Macro to find next blank cell in a column

LKulikamp

New Member
Joined
Sep 18, 2018
Messages
1
I need to include a line that will find the next blank cell in column A and then run the macro.
Here is the macro as it is now:

Sheets("Sheet2").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = "=NOW()"
Range("A1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("A2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = ""
Range("A2").Select
Sheets("Sheet1").Select
Range("D2").Selec
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Like this?

Code:
Sub findblank()

Sheets("Sheet2").Select
Range("A1").End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Copy
ActiveCell.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False


End Sub
 
Upvote 0
Or :
Code:
Sub findblank()
Sheets("Sheet2").Select
[A1].End(xlDown)(2) = Format(Now(), "dd/mm/yyyy hh:mm AM/PM")
End Sub
Or perhaps :
Code:
Sub findblank()
Sheets("Sheet2").Select
Cells(Rows.Count, "A").End(xlUp)(2) = Format(Now(), "dd/mm/yyyy hh:mm AM/PM")
End Sub
 
Upvote 0
I think your trying to write a script to do a little more then just this:
It is good that your wanting to learn more about writing script's.
Why not tell us your full ultimate goal and let us write a script for you and maybe you can learn more from that.

All this selecting is not really needed

To enter a value into Sheet(2).Range("B5")

Only requires this:

Sheets(2).Range("B5").value=Now()

Like this:

Code:
Sub Now_Please()
Sheets(2).Range("B5").Value = Now()
End Sub
 
Upvote 0
You don't really have to select the worksheet to do what you asked for on it (of course, you can if you want to though)...
Code:
Sub FindBlank()
  Sheets("Sheet2").Columns("A").SpecialCells(xlBlanks)(1) = Now
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,151
Members
453,021
Latest member
Justyna P

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