Hi All,
I have created the below macro using macro recorder, and need some help to loop the task until now more links in column C.
Task:
Open up a workbook via a hyperlink in column "C" on a master file, in the newly opened workbook copy a row of data in a hidden sheet and paste this data into the master file on the same row as the hyperlink, then close the file. and repeat this for the next hyperlink in the column until no more hyperlinks
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]hyperlink1.xlsm[/TD]
[TD]copied data[/TD]
[TD]copied data[/TD]
[TD]copied data[/TD]
[TD]copied data[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]hyperlink2.xlsm[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]hyperlink2.xlsm[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
using macro recorder
Sub Consolidation()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Windows("Masterfile.xlsm").Activate
Range("C4").Hyperlinks(1).Follow
Windows("hyperlink1.xlsm").Visible = True
Sheets("hiddensheet").Visible = True
Sheets("hiddensheet").Select
Range("B4:E4").Select
Selection.Copy
Windows("Masterfile.xlsm").Activate
Range("D4").Select
ActiveSheet.Paste
Windows("hyperlink1.xlsm").Activate
Sheets("hiddensheet").Select
ActiveWindow.SelectedSheets.Visible = False
ActiveWindow.Close savechanges:=False
Windows("Masterfile.xlsm").Activate
Application.DisplayAlerts = False
Application.ScreenUpdating = True
End Sub
I have created the below macro using macro recorder, and need some help to loop the task until now more links in column C.
Task:
Open up a workbook via a hyperlink in column "C" on a master file, in the newly opened workbook copy a row of data in a hidden sheet and paste this data into the master file on the same row as the hyperlink, then close the file. and repeat this for the next hyperlink in the column until no more hyperlinks
[TABLE="width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]hyperlink1.xlsm[/TD]
[TD]copied data[/TD]
[TD]copied data[/TD]
[TD]copied data[/TD]
[TD]copied data[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]hyperlink2.xlsm[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]hyperlink2.xlsm[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
using macro recorder
Sub Consolidation()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Windows("Masterfile.xlsm").Activate
Range("C4").Hyperlinks(1).Follow
Windows("hyperlink1.xlsm").Visible = True
Sheets("hiddensheet").Visible = True
Sheets("hiddensheet").Select
Range("B4:E4").Select
Selection.Copy
Windows("Masterfile.xlsm").Activate
Range("D4").Select
ActiveSheet.Paste
Windows("hyperlink1.xlsm").Activate
Sheets("hiddensheet").Select
ActiveWindow.SelectedSheets.Visible = False
ActiveWindow.Close savechanges:=False
Windows("Masterfile.xlsm").Activate
Application.DisplayAlerts = False
Application.ScreenUpdating = True
End Sub