Hello,
My code will run the rest of the macro, but I am having trouble pulling the tab name to be changed before the save and export.
My tab name will have elements from String names run and identified in other code running in this workbook. I am trying to pull the name in total with the first macro.
The second macro is my attempt at renaming the tab before save and export as CSV of this worksheet.
I keep getting an error 9. Subscript out of range on the sheets("ProName") in the second macro.
My code will run the rest of the macro, but I am having trouble pulling the tab name to be changed before the save and export.
My tab name will have elements from String names run and identified in other code running in this workbook. I am trying to pull the name in total with the first macro.
The second macro is my attempt at renaming the tab before save and export as CSV of this worksheet.
I keep getting an error 9. Subscript out of range on the sheets("ProName") in the second macro.
Code:
Sub Tabname_Pro()
Dim ProName As String
Dim Filenumber, Study As String
ProName = Study & "_Run" & Filenumber & "_Pro"
' Study & "_Run" & Filenumber & "_Pro"
With sheets("XXX_Pro_Run")
'.Value = ProName
.Name = ProName
End With
End sub
Code:
Sub CSVLIMS()
Call Tabname_Pro
Dim ProName As String
Application.Left = 1466.5
Application.Top = 7.75
sheets("ProName").Select
Range("A1:K42").Select
Cells.Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ChDir "\\server\Templates"
ActiveWorkbook.SaveAs Filename:= _
"\\server\Templates\ProName.csv" _
, FileFormat:=xlCSV, CreateBackup:=False
ActiveWindow.Close
sheets("RUN-Setup").Select
Range("A2").Select
End Sub