tlc53
Active Member
- Joined
- Jul 26, 2018
- Messages
- 399
Hi there,
I currently have VBA code under both Module and the Worksheet which I would like to combine under one macro to run together. Independently, they all work fine. Below are the codes and in the order I would like them to run. All information is located on Sheet81 but the macro will be run from Sheet13 (so it all needs to be under Module11). I tried fudging them together but I'm outside my depth. Your help would be appreciated! Thank you!
'First code to run, currently on Sheet81
Sub ssFav()
Dim response As String
response = InputBox("1/3 Enter notes to client regarding Input tax..")
Range("D53").Value = response
response = InputBox("2/3 Enter notes to client regarding Output tax..")
Range("D101").Value = response
response = InputBox("3/3 Enter notes to client regarding Overall Balance..")
Range("D106").Value = response
End Sub
' Second codes to run, currently on Sheet81
Sub tlc53()
Dim Cl As Range
For Each Cl In Sheet81.Range("I15:I49")
Cl.EntireRow.Hidden = IIf(Cl = 0, True, False)
Next Cl
End Sub
Sub tlc534()
Dim Cl As Range
For Each Cl In Sheet81.Range("I63:I97")
Cl.EntireRow.Hidden = IIf(Cl = 0, True, False)
Next Cl
End Sub
Last code to run, currently under Module11
Option Explicit
Sub PDFActiveSheetGSTREC()
'www.contextures.com
'for Excel 2010 and later
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
Dim blnWasSheetHidden As Boolean
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = Sheet80
'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & ""
strName = wsA.Range("A1").Value _
& " - " & wsA.Range("A2").Value _
& " " & Format(wsA.Range("A3"), "dd.mm.yy")
'create default name for savng file
strFile = strName & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
(InitialFileName:=strName & ".pdf", _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If myFile <> "False" Then
If wsA.Visible = xlSheetHidden Then
wsA.Visible = xlSheetVisible
blnWasSheetHidden = True
End If
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=myFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
If blnWasSheetHidden = True Then
wsA.Visible = xlSheetHidden
End If
'confirmation message with file info
MsgBox "PDF file has been created: " _
& vbCrLf _
& myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub
I currently have VBA code under both Module and the Worksheet which I would like to combine under one macro to run together. Independently, they all work fine. Below are the codes and in the order I would like them to run. All information is located on Sheet81 but the macro will be run from Sheet13 (so it all needs to be under Module11). I tried fudging them together but I'm outside my depth. Your help would be appreciated! Thank you!
'First code to run, currently on Sheet81
Sub ssFav()
Dim response As String
response = InputBox("1/3 Enter notes to client regarding Input tax..")
Range("D53").Value = response
response = InputBox("2/3 Enter notes to client regarding Output tax..")
Range("D101").Value = response
response = InputBox("3/3 Enter notes to client regarding Overall Balance..")
Range("D106").Value = response
End Sub
' Second codes to run, currently on Sheet81
Sub tlc53()
Dim Cl As Range
For Each Cl In Sheet81.Range("I15:I49")
Cl.EntireRow.Hidden = IIf(Cl = 0, True, False)
Next Cl
End Sub
Sub tlc534()
Dim Cl As Range
For Each Cl In Sheet81.Range("I63:I97")
Cl.EntireRow.Hidden = IIf(Cl = 0, True, False)
Next Cl
End Sub
Last code to run, currently under Module11
Option Explicit
Sub PDFActiveSheetGSTREC()
'www.contextures.com
'for Excel 2010 and later
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As String
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
Dim blnWasSheetHidden As Boolean
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = Sheet80
'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & ""
strName = wsA.Range("A1").Value _
& " - " & wsA.Range("A2").Value _
& " " & Format(wsA.Range("A3"), "dd.mm.yy")
'create default name for savng file
strFile = strName & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
(InitialFileName:=strName & ".pdf", _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Select Folder and FileName to save")
'export to PDF if a folder was selected
If myFile <> "False" Then
If wsA.Visible = xlSheetHidden Then
wsA.Visible = xlSheetVisible
blnWasSheetHidden = True
End If
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=myFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
If blnWasSheetHidden = True Then
wsA.Visible = xlSheetHidden
End If
'confirmation message with file info
MsgBox "PDF file has been created: " _
& vbCrLf _
& myFile
End If
exitHandler:
Exit Sub
errHandler:
MsgBox "Could not create PDF file"
Resume exitHandler
End Sub