Hi All,
I'm very new in writing VBA. Please help me in activating already open workbook. Following is the code i'm using but don't know how to complete it. Please help.
Sub AssessmentDataPaste()
Dim MyPath As String
MyPath = Sheets("Main").Range("C7").Value
' Pop-up a msgbox if NO path is available in the field.
If MyPath = "" Then
MsgBox ("Please provide a valid destination/file path.")
End If
Workbooks.Open Filename:=MyPath
Range("F12:F3000").Select
Selection.Copy
Workbooks("Ingestion_Template.xlsm").Activate
Sheets("IngestionTemplate").Activate
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B7").Select
Workbooks.Activate
Range("P12:P3000").Select
Selection.Copy
Workbooks("Ingestion_Template.xlsm").Activate
Sheets("IngestionTemplate").Activate
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C7").Select
End Sub
I'm very new in writing VBA. Please help me in activating already open workbook. Following is the code i'm using but don't know how to complete it. Please help.
Sub AssessmentDataPaste()
Dim MyPath As String
MyPath = Sheets("Main").Range("C7").Value
' Pop-up a msgbox if NO path is available in the field.
If MyPath = "" Then
MsgBox ("Please provide a valid destination/file path.")
End If
Workbooks.Open Filename:=MyPath
Range("F12:F3000").Select
Selection.Copy
Workbooks("Ingestion_Template.xlsm").Activate
Sheets("IngestionTemplate").Activate
Range("B7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B7").Select
Workbooks.Activate
Range("P12:P3000").Select
Selection.Copy
Workbooks("Ingestion_Template.xlsm").Activate
Sheets("IngestionTemplate").Activate
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("C7").Select
End Sub