Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dim ws as excel.worksheet, bFound as boolean
bfound = fasle
for each ws in xl.wb.worksheets
if ws.name = YourNameVar then bfound = true
next
if bfound then
set ws = xl.wb.worksheets(YourNameVar)
else
set ws = xl.wb.worksheets.add
ws.name = YourNameVar
end if
...
set aSheet = wbExcel.sheets("newSheet")
if aSheet.cells(99,99) = "anything" then
wbExcel.sheets.add.name = "newSheet"
set aSheet = wbExcel.sheets("newSheet")
end if
...
for thissheet = 1 to wbExcel.worksheets.count
if wbExcel.worksheets(thissheet).name = YourNameVar then
bfound = -1
exit for
end if
next
if bfound then '
set aSheet = wbExcel.worksheets(thissheet)
else
wbExcel.worksheets.add.name = YourNameVar
set aSheet = wbExcel.worksheets(YourNameVar)
end if
The help file is not very helpful, play with the following code to see what I mean.obscure help file said:EXTRA! Basic has no true Boolean variables. EXTRA! Basic considers 0 to be FALSE and any other numeric value to be TRUE. Only numeric values can be used as Booleans. Comparison operator expressions always return 0 for FALSE and -1 for TRUE.
sub main
dim bFakeBool as integer
'uncomment one of the two following lines to test
'bFakeBool = -1 '"anything <= -1 evaluates true"
'bFakeBool = 0 '"anything > -1 evaluates false"
if bFakeBool then
msgbox "true"
else
msgbox "false"
end if
if bFakeBool <= -1 then
msgbox "true"
else
msgbox "false"
end if
end sub