Naresh Patel
asked on
Simple Excel VBA
Hi Experts,
I just need to Merge this two VBA Macro in to one.
Thank You
I just need to Merge this two VBA Macro in to one.
Sub Demo()
Dim wbCurrent As Workbook, wbData As Workbook, wbResult As Workbook
Set wbCurrent = ActiveWorkbook
Set wbData = Workbooks.Open("H:\4.Trading Master\Thunderbolt\Simple Excel Formula\Data.xlsx")
Set wbResult = Workbooks.Open("H:\4.Trading Master\Thunderbolt\Simple Excel Formula\Result.xlsx")
If wbData.Sheets(1).Name = wbResult.Sheets(1).Name Then
wbData.Activate
wbData.Sheets(1).Range("A1:F" & Range("F1048576").End(xlUp).Row).Copy
wbCurrent.Activate
Range("A1").PasteSpecial
wbResult.Activate
wbResult.Sheets(1).Range("A3:C3").Copy
wbCurrent.Activate
Range("L3:N3").PasteSpecial
End If
wbData.Close False
wbResult.Close False
End Sub
Sub Demo2()
Dim wbCurrent As Workbook, wbData As Workbook, wbResult As Workbook
Dim varData() As String
Set wbCurrent = ActiveWorkbook
Set wbData = Workbooks.Open("H:\4.Trading Master\Thunderbolt\Simple Excel Formula\Data.xlsx")
Set wbResult = Workbooks.Open("H:\4.Trading Master\Thunderbolt\Simple Excel Formula\Result.xlsx")
If wbData.Sheets(1).Name <> wbResult.Sheets(1).Name Then
wbData.Activate
wbData.Sheets(1).Range("A1:F" & Range("F1048576").End(xlUp).Row).Copy
wbCurrent.Activate
Range("A1").PasteSpecial
varData = Split(InputBox("Please enter value for L3:N3, seperated by a space.", "Data input"), " ")
wbCurrent.Sheets(1).Range("L3").Value = varData(0)
wbCurrent.Sheets(1).Range("M3").Value = varData(1)
wbCurrent.Sheets(1).Range("N3").Value = varData(2)
End If
wbData.Close False
wbResult.Close False
End Sub
Thank You
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
May I ask new question for same context?
Go ahead.
ASKER
to frame it will take 5 min... pls Waite as I don't know which part of world you are living...may late there...
ASKER
ASKER