TL;DR - 1) how do you test if a sheet name exists, 2) how do you create a sheet - I'm new, the more details/descriptions you provide the better.
I am trying to figure out (what I assume to be) a simple function but I am drawing a blank. I am working with 2 workbooks at a time, and I need a function for if the master workbook does not contain a sheet with the sheet name from the sub workbook, it should create it.
I already have the sheet name from the sub workbook as a variable %SheetName%, I just need to confirm if the master workbook has that sheet.
Below is my subroutine - im new, so bare with me =)
First section of the subroutine is where I need the test for the sheet. The rest is checking if the row is blank; if so, write the data variables (which also could be done a lot more elegantly, but it works). Please let me know if you think you can help with this function.
Code: Select all
mENTER: ; process into excel master file
{ ; If sheet does not exist, create it
}
ROWm++
Loop,
{
LineT := wrkbk1.Sheets(SheetName).Range("A"ROWm).Text
if (LineT = "")
{
break
}
else
{
ROWm++
}
}
wrkbk1.Sheets(SheetName).Range("A"ROWm).Characters.Text := ACT
wrkbk1.Sheets(SheetName).Range("B"ROWm).Characters.Text := MAWB
wrkbk1.Sheets(SheetName).Range("C"ROWm).Characters.Text := HAWB
ROWm = ; reset row test
Return