View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default macro to date stamp to the right of the macro command button

If you're copying the button down the worksheet and it's working, I bet you're
using the button from the Forms toolbar (not the commandbutton from the control
toolbox toolbar).

And this means that you have a macro assigned to this button.

You could use something like this:

with activesheet.buttons(application.caller).topleftcel l.offset(0,1)
.numberformat = "mmmm dd, yyyy hh:mm:ss"
.value = now
end with

If the button covers more than one cell (horizontally), then you may want to
offset by more than 1 column.

Roha wrote:

I would like to make a macro tied to a command button to stamp the current
date/time in the cell directly to the right of the button. So if I put the
button in cell A1, I would want the date stamp to be in B1. I also want to
be able to copy this button down a sheet and have the macro advance
accordingly. I have the macro working find, and I tried to use R1C1
referencing, but the button cell is not necessarily the active cell, so it
stamps the date/time in the wrong adjacent cell.
Any ideas?


--

Dave Peterson