strangerhere
New Member
- Joined
- Jan 13, 2012
- Messages
- 7
Greetings
I am trying to find the easiest way to:
1. Copy values from all Defined Names in a Worksheet
2. Paste those values into a different Workbook (Worksheet) where the Defined Names match.
I have this code so far (pasted partial), that does work, but required manually retrieving each Defined Name. I'm searching for a better way to do this.. perhaps a loop.. but not sure.
Sub Macro1()
Dim SourceFile As String
Dim wb As Workbook
Set wb = Workbooks.Open(Application.GetOpenFilename)
wb.Activate
Sheets("New Input Sheet").Select
SourceFile = Range("ProjectName", "GTPO").Select
Selection.Copy
Windows("ARC_RRC Calculator V10.1.xls").Activate
Range("ProjectName", "GTPO").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
wb.Activate
Sheets("New Input Sheet").Select
SourceFile = Range("Srm:OtherInputName").Select
Selection.Copy
Windows("ARC_RRC Calculator V10.1.xls").Activate
Range("Srm:OtherInputName").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
I am trying to find the easiest way to:
1. Copy values from all Defined Names in a Worksheet
2. Paste those values into a different Workbook (Worksheet) where the Defined Names match.
I have this code so far (pasted partial), that does work, but required manually retrieving each Defined Name. I'm searching for a better way to do this.. perhaps a loop.. but not sure.
Sub Macro1()
Dim SourceFile As String
Dim wb As Workbook
Set wb = Workbooks.Open(Application.GetOpenFilename)
wb.Activate
Sheets("New Input Sheet").Select
SourceFile = Range("ProjectName", "GTPO").Select
Selection.Copy
Windows("ARC_RRC Calculator V10.1.xls").Activate
Range("ProjectName", "GTPO").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
wb.Activate
Sheets("New Input Sheet").Select
SourceFile = Range("Srm:OtherInputName").Select
Selection.Copy
Windows("ARC_RRC Calculator V10.1.xls").Activate
Range("Srm:OtherInputName").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False