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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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