View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to add todays date (static) to the current active cell using m

Dim DestCell as range
with worksheets("logsheet")
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with
destcell.value = now




JimmyJam75 wrote:

Hello,

I have a worksheet that I'd like to apply the current date and time
(adjacent cells) in the next blank row auotmatically when the worksheet is
opened. i.e. if row 10 is blank on open, then A10 will have the date applied
and A11 the time. Both values must remain static.

I've started by trying to write a macro that will insert the current date
value into the active cell. See code below:

Dim james_stamp As Date
Dim james_range As Range
james_stamp = Now()
james_range = ActiveCell.Range
Range("james_range").Value = james_stamp

I'm having problems capturing the active cell and then using this value
within the 'Range' function. My next challenge was replacing the active cell
value with the 'next blank cell'. Then I'd need to run this macro on opening
the worksheet.

Can anyone push me in the right direction?

Many thanks,

JJ


--

Dave Peterson