deepak_bhalla
New Member
- Joined
- Sep 3, 2015
- Messages
- 5
Hi !
I am trying to make a dashboard for a particular excel file in which I have around 30 sheets in similar format. I need to link certain data fields on my dashboard. WHile trying to do that I created the following Macro however it only works for first 3 sheets. I want this to run for all sheet in the file.
Sub Macro1()
'
' Macro1 Macro
'
'
Sheets("ASGS").Select
Range("A3:D3").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("B3").Select
Sheets("ASGS").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("C3").Select
Sheets("ASGS").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D3").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("E3").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("B13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("F3").Select
ActiveSheet.Paste Link:=True
Range("G3").Select
Sheets("ASGS").Select
Range("E12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("E13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("H3").Select
ActiveSheet.Paste Link:=True
Range("A4").Select
Sheets("AIS").Select
Range("A3:D3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("B4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("C4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("E4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("F4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("E12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("G4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("E13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("H4").Select
ActiveSheet.Paste Link:=True
Range("A5").Select
Sheets("APJ Pitampura").Select
Range("A3:D3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("APJ Pitampura").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("B5").Select
ActiveSheet.Paste Link:=True
Sheets("APJ Pitampura").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("C5").Select
ActiveSheet.Paste
Sheets("APJ Pitampura").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D5").Select
ActiveSheet.Paste
Range("E5").Select
Sheets("APJ Pitampura").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("F5").Select
Sheets("APJ Pitampura").Select
Range("B13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("G5").Select
Sheets("APJ Pitampura").Select
Range("E12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("APJ Pitampura").Select
Range("E13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("H5").Select
ActiveSheet.Paste Link:=True
Application.CutCopyMode = False
ChDir "Y:\Data\E\A\A Reports"
End Sub
Please help.
Thanks and Regards
Deepak Bhalla
I am trying to make a dashboard for a particular excel file in which I have around 30 sheets in similar format. I need to link certain data fields on my dashboard. WHile trying to do that I created the following Macro however it only works for first 3 sheets. I want this to run for all sheet in the file.
Sub Macro1()
'
' Macro1 Macro
'
'
Sheets("ASGS").Select
Range("A3:D3").Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("B3").Select
Sheets("ASGS").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("C3").Select
Sheets("ASGS").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D3").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("E3").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("B13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("F3").Select
ActiveSheet.Paste Link:=True
Range("G3").Select
Sheets("ASGS").Select
Range("E12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("ASGS").Select
Range("E13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("H3").Select
ActiveSheet.Paste Link:=True
Range("A4").Select
Sheets("AIS").Select
Range("A3:D3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("B4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("C4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("E4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("B13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("F4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("E12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("G4").Select
ActiveSheet.Paste Link:=True
Sheets("AIS").Select
Range("E13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("H4").Select
ActiveSheet.Paste Link:=True
Range("A5").Select
Sheets("APJ Pitampura").Select
Range("A3:D3").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("APJ Pitampura").Select
Range("B6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("B5").Select
ActiveSheet.Paste Link:=True
Sheets("APJ Pitampura").Select
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("C5").Select
ActiveSheet.Paste
Sheets("APJ Pitampura").Select
Range("B8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("D5").Select
ActiveSheet.Paste
Range("E5").Select
Sheets("APJ Pitampura").Select
Range("B12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("F5").Select
Sheets("APJ Pitampura").Select
Range("B13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Range("G5").Select
Sheets("APJ Pitampura").Select
Range("E12").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste Link:=True
Sheets("APJ Pitampura").Select
Range("E13").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
Range("H5").Select
ActiveSheet.Paste Link:=True
Application.CutCopyMode = False
ChDir "Y:\Data\E\A\A Reports"
End Sub
Please help.
Thanks and Regards
Deepak Bhalla