Hi Everyone,
I need some help on the 2 Macros below. I want to run them from separate buttons in a worksheet named "Dashboard"
on a different sheet named "Day End Report" in the same workbook. The first imports data from another workbook and the
second compacts that data. At this point I can only get them to run on whichever sheet I have open at the time.
Thank You!
I need some help on the 2 Macros below. I want to run them from separate buttons in a worksheet named "Dashboard"
on a different sheet named "Day End Report" in the same workbook. The first imports data from another workbook and the
second compacts that data. At this point I can only get them to run on whichever sheet I have open at the time.
Thank You!
Code:
Private Sub CommandButton1_Click()' Macro1 Macro()
Dim wkbCrntWorkBook As Workbook
Dim wkbSourceBook As Workbook
Dim rngSourceRange As Range
Dim rngDestination As Range
Set wkbCrntWorkBook = ActiveWorkbook
With Application.FileDialog(msoFileDialogOpen)
.Filters.Clear
.Filters.Add "Excel 2007-13", "*.xlsx; *.xlsm; *.xlsa; *.csv"
.AllowMultiSelect = False
.Show
If .SelectedItems.Count > 0 Then
Workbooks.Open .SelectedItems(1)
Set wkbSourceBook = ActiveWorkbook
Set rngSourceRange = Application.InputBox(prompt:="Select source range", Title:="Source Range", Default:="A1:I400", Type:=8)
wkbCrntWorkBook.Activate
Set rngDestination = Application.InputBox(prompt:="Select destination cell", Title:="Select Destination", Default:="A1", Type:=8)
rngSourceRange.Copy rngDestination
wkbSourceBook.Close False
End If
End With
End Sub
Code:
Private Sub CommandButton3_Click()'
' Macro3 Macro
'
'
Range("A78:I400").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlToLeft
Columns("A:I").Select
Range("I1").Activate
Selection.EntireColumn.Hidden = True
Range("K1").Select
End Sub