Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 102
Default Excel Macro Question?

Hi everyone,

I am trying to create two macros, macro1 copies from cell b3 and pastes
it in F6, and macro2 copies from cell b4 and pastes it in F7. I also
create two buttons; one for each macro.

Then I assign button1 for macro1 and button2 for macro2. When I try
each macro, I realize that each is copying from cell b4! In other
words, both macros are copying from b4 and pasting same thing in cells
F6 and F7!

Why, and how can I fix that?

Thanks,
Mike

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Excel Macro Question?

Try these routines for your macros:

Sub mac1()
Set r1 = Range("B3")
Set r2 = Range("F6")
r1.Copy r2
End Sub
Sub mac2()
Set r1 = Range("B4")
Set r2 = Range("F7")
r1.Copy r2
End Sub
--
Gary's Student


"Mike" wrote:

Hi everyone,

I am trying to create two macros, macro1 copies from cell b3 and pastes
it in F6, and macro2 copies from cell b4 and pastes it in F7. I also
create two buttons; one for each macro.

Then I assign button1 for macro1 and button2 for macro2. When I try
each macro, I realize that each is copying from cell b4! In other
words, both macros are copying from b4 and pasting same thing in cells
F6 and F7!

Why, and how can I fix that?

Thanks,
Mike


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,073
Default Excel Macro Question?

Hi Mike,

If you used the macro recorder, was the referencing absolute or
relative?
If it was relative, then what is copied and where it is pasted depends
on the address of the selected cell when you ran the macro.
If it as absoute then it will always be B3 copied /pasted into F6 for
macro1 and B4 copied/pasted into F7 for macro2

Ken Johnson

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
Excel macro [email protected] Excel Discussion (Misc queries) 1 May 27th 06 04:00 PM
Possible Macro Timing Overrun generates Excel Exception [email protected] Excel Discussion (Misc queries) 2 February 23rd 06 04:10 PM
excel 4.0 macro removal tool Sachin Shah Excel Discussion (Misc queries) 0 August 25th 05 04:17 AM
excel 4.0 macro remover tool Sachin Shah Excel Discussion (Misc queries) 0 August 25th 05 04:14 AM
Excel Formula/Worksheet maybe Macro Question Todd Beauchemin Excel Worksheet Functions 3 June 18th 05 05:18 AM


All times are GMT +1. The time now is 01:56 PM.

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

About Us

"It's about Microsoft Excel"