#1   Report Post  
Posted to microsoft.public.excel.misc
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

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 806
Default macro code question

Hello Maria,

Private Sub CommandButton1_Click()
Range("A1").Formula = Range("A2").value
End Sub

Regards,
Bernd
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default macro code question

Hi Bernd!!!!!!!

Thank you so much for the quick reply, it worked great!
-maria

"Bernd P" wrote:

Hello Maria,

Private Sub CommandButton1_Click()
Range("A1").Formula = Range("A2").value
End Sub

Regards,
Bernd

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 71
Default macro code question

Hi Bernd again,

I was quick to say thanks before I have one more question for you...

Let's say I wanted A1 to copy what is in A2 of Sheet 2 in the same workbook,
how would I do that?

I tried sheet2!A2 but that did not seem to work.

Thanks again for you help, your great!
-Maria


"Maria" wrote:

Hi Bernd!!!!!!!

Thank you so much for the quick reply, it worked great!
-maria

"Bernd P" wrote:

Hello Maria,

Private Sub CommandButton1_Click()
Range("A1").Formula = Range("A2").value
End Sub

Regards,
Bernd

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default macro code question

how about:

Sheets("sheet2").Range("A2").Copy
Sheets("sheet1").Range("A1").PasteSpecial Paste:=xlPasteValues


On 6 Mar, 21:16, Maria wrote:
Hi Bernd again,

I was quick to say thanks before I have one more question for you...

Let's say I wanted A1 to copy what is in A2 of Sheet 2 in the same workbook,
how would I do that? *

I tried sheet2!A2 *but that did not seem to work.

Thanks again for you help, your great!
-Maria



"Maria" wrote:
Hi Bernd!!!!!!!


Thank you so much for the quick reply, it worked great!
-maria


"Bernd P" wrote:


Hello Maria,


Private Sub CommandButton1_Click()
Range("A1").Formula = Range("A2").value
End Sub


Regards,
Bernd- Ukryj cytowany tekst -


- Pokaż cytowany tekst -




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 806
Default macro code question

Hello Maria,

Private Sub CommandButton1_Click()
Sheets("Sheet1").Range("A1").Formula = Sheets("Sheet2")Range
("A2").value
End Sub

Regards,
Bernd
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 206
Default macro code question

On Mar 6, 12:32*pm, Maria wrote:
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

worksheets("Sheet1").range("A1")=worksheets(Sheet2 ").range("A2").value
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
code question Shu of AZ Excel Discussion (Misc queries) 2 July 12th 08 01:10 AM
vb code question Stan Excel Discussion (Misc queries) 8 April 25th 08 10:43 PM
A macro code question from a novice Richard Excel Discussion (Misc queries) 2 December 24th 07 07:22 PM
Another code question M&M[_2_] Excel Discussion (Misc queries) 3 August 9th 07 10:00 PM
VBA code question JEV Excel Discussion (Misc queries) 2 March 1st 07 06:02 PM


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"