Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default Running a macro in a selected cell...

This is probably a simple question, but I can't seem to figure it out...

I want to run a task of pasting several rows and columns of information into
a cell that is selected by the user.

I recorded a Macro and asigned it to a rectangular button that will copy the
information, but how can I make it paste the information starting in the
selected cell?

Thanks in advance.


  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Running a macro in a selected cell...

dim RngToCopy as range

Set rngtocopy = worksheets("sheet99").range("a1:b99") 'or something

rngtocopy.copy _
destination:=activecell

=========
You could even ask where it should be pasted:

dim RngToCopy as range
Dim DestCell as range

set destcell = nothing
on error resume next
set destcell = application.inputbox(prompt:="select a cell",type:=8).cells(1)
on error goto 0

if destcell is nothing then
exit sub 'user hit cancel
end if

Set rngtocopy = worksheets("sheet99").range("a1:b99") 'or something

rngtocopy.copy _
destination:=destcell



Steve wrote:

This is probably a simple question, but I can't seem to figure it out...

I want to run a task of pasting several rows and columns of information into
a cell that is selected by the user.

I recorded a Macro and asigned it to a rectangular button that will copy the
information, but how can I make it paste the information starting in the
selected cell?

Thanks in advance.



--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Steve
 
Posts: n/a
Default Running a macro in a selected cell...

Thank you Dave.

"Dave Peterson" wrote:

dim RngToCopy as range

Set rngtocopy = worksheets("sheet99").range("a1:b99") 'or something

rngtocopy.copy _
destination:=activecell

=========
You could even ask where it should be pasted:

dim RngToCopy as range
Dim DestCell as range

set destcell = nothing
on error resume next
set destcell = application.inputbox(prompt:="select a cell",type:=8).cells(1)
on error goto 0

if destcell is nothing then
exit sub 'user hit cancel
end if

Set rngtocopy = worksheets("sheet99").range("a1:b99") 'or something

rngtocopy.copy _
destination:=destcell



Steve wrote:

This is probably a simple question, but I can't seem to figure it out...

I want to run a task of pasting several rows and columns of information into
a cell that is selected by the user.

I recorded a Macro and asigned it to a rectangular button that will copy the
information, but how can I make it paste the information starting in the
selected cell?

Thanks in advance.



--

Dave Peterson

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
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Macro running when a cell is exited Daniel Lees Excel Discussion (Misc queries) 1 July 20th 05 02:45 PM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
how read value from last selected cell? It is possible? how get adress last selected cell? Andrzej New Users to Excel 4 May 30th 05 07:28 PM


All times are GMT +1. The time now is 02:19 AM.

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"