Here is the code I have right now
Public ReportFile as Workbook
Public ReportWorksheet as Worksheet
Sub VBA_Project()
Define_File
Define_Tab
Data_Cleanup
End Sub
Sub Define_File()
Dim ReportFilePath As Variant
ReportFilePath = Application.GetOpenFilename(filefilter:="excel Files,*.xl*;*xm*")
If ReportFilePath <> False Then
Workbooks.Open Filename:=ReportFilePath
End If
Dim ReportFile As Workbook
Set ReportFile = ActiveWorkbook
End Sub
sub define_tab()
'code to get to the desired worksheet'
Dim DataWorksheet As Worksheet
Set DataWorksheet = ActiveSheet
end sub
Sub Data_Cleanup()
ReportFile.Activate
DataWorksheet.select
'some more code'
end sub
I have tested the variables in the subs they are defined in and they worked perfectly fine. I am trying to run the macro using the first sub that references the others.
Public ReportFile as Workbook
Public ReportWorksheet as Worksheet
Sub VBA_Project()
Define_File
Define_Tab
Data_Cleanup
End Sub
Sub Define_File()
Dim ReportFilePath As Variant
ReportFilePath = Application.GetOpenFilename(filefilter:="excel Files,*.xl*;*xm*")
If ReportFilePath <> False Then
Workbooks.Open Filename:=ReportFilePath
End If
Dim ReportFile As Workbook
Set ReportFile = ActiveWorkbook
End Sub
sub define_tab()
'code to get to the desired worksheet'
Dim DataWorksheet As Worksheet
Set DataWorksheet = ActiveSheet
end sub
Sub Data_Cleanup()
ReportFile.Activate
DataWorksheet.select
'some more code'
end sub
I have tested the variables in the subs they are defined in and they worked perfectly fine. I am trying to run the macro using the first sub that references the others.