ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Help with a macro (https://www.excelbanter.com/setting-up-configuration-excel/66713-help-macro.html)

peter

Help with a macro
 
I am tring to write a macro that opens a sheet and copies cell from it
to my original sheet. The copied cells are in the same place on the
sheet, but the thing is, the name of the sheet changes. I guess what
I'm asking is is there a way to have it prompt me for the name of the
sheet I'm going to copy from?

Thanks,

Peter


Gary''s Student

Help with a macro
 
Try:


Option Explicit

Sub CopyFromPasteTo()

Dim strF As String
Dim strT As String
Dim rngF As Range
Dim rngT As Range

strF = Application.InputBox("Enter from range", Type:=2)
Set rngF = Range(strF)

strT = Application.InputBox("Enter goto range", Type:=2)
Set rngT = Range(strT)

rngF.Copy rngT

End Sub

--
Gary''s Student


"peter" wrote:

I am tring to write a macro that opens a sheet and copies cell from it
to my original sheet. The copied cells are in the same place on the
sheet, but the thing is, the name of the sheet changes. I guess what
I'm asking is is there a way to have it prompt me for the name of the
sheet I'm going to copy from?

Thanks,

Peter



peter

Help with a macro
 
Ok, Gary, I'll give it a try at work tomorrow.

Thanks a lot!

Peter



All times are GMT +1. The time now is 08:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com