Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel Macro Question?
You could post your macros here for comments
-- Don Guillett SalesAid Software "Mike" wrote in message oups.com... 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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel Macro Question?
I found the problem......thanks Don
Don Guillett wrote: You could post your macros here for comments -- Don Guillett SalesAid Software "Mike" wrote in message oups.com... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel macro | Excel Discussion (Misc queries) | |||
Possible Macro Timing Overrun generates Excel Exception | Excel Discussion (Misc queries) | |||
excel 4.0 macro removal tool | Excel Discussion (Misc queries) | |||
excel 4.0 macro remover tool | Excel Discussion (Misc queries) | |||
Excel Formula/Worksheet maybe Macro Question | Excel Worksheet Functions |