View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Maria Maria is offline
external usenet poster
 
Posts: 71
Default macro code question

Hi guys,

I know this is a MAC forum and I am on excel 2003 but I thought maybe
someone can help...

I have a button that when you click on it, it makes cell A1 duplicate what
is in cell A2. But I need to have clicked on A1 before I press the button
for it to work. For example if I happen to be on cell D4 and click the
button, then a 0 goes in the D4 cell and nothing happens in the A1, it does
not not duplicate whats in A2.

I would like the D4 cell to be ignored and just have the button coded to
where when I click it, regardless of where my cursor is, the A1 cell will
duplicate what is in A2.

I hope it is a simple line or command that I can put in the code. Thanks to
anyone who can help! -maria

Here is the code I have for the button now:

Private Sub CommandButton1_Click()
ActiveCell.FormulaR1C1 = ""
ActiveCell.FormulaR1C1 = "=R[1]C"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub