Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Does Sheet exist? If True Use If False Create
When my macro prints addresses from my form i create a sheet called 'print'. I then scale the sheet to A6 size - landscape - paste the data i need into this sheet and then print the record. What i need is the VBA code for Checking to see if this sheet exists already. If it does then i would like to use it. If not i need to create it. i.e. If activesheet.("print")=true Then If False - not sure Call insertData End If Set NewSheet = Worksheets.Add NewSheet.Name = "Print" Call InsertData I know the code above in nonsense but it should help the Macro guru's come up with the cunning solution to my problem, hopefully. -- Shake ------------------------------------------------------------------------ Shake's Profile: http://www.excelforum.com/member.php...o&userid=28577 View this thread: http://www.excelforum.com/showthread...hreadid=483011 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Does Sheet exist? If True Use If False Create
try:
Sub addsht() Dim prnt As Worksheet On Error Resume Next Set prnt = Sheets("Print") On Error GoTo 0 If Not prnt Is Nothing Then 'do whatever with prnt eg prnt.activate Else Set prnt = Sheets.Add prnt.Name = "Print" 'do the rest End If End Sub Hope this helps Rowan Shake wrote: When my macro prints addresses from my form i create a sheet called 'print'. I then scale the sheet to A6 size - landscape - paste the data i need into this sheet and then print the record. What i need is the VBA code for Checking to see if this sheet exists already. If it does then i would like to use it. If not i need to create it. i.e. If activesheet.("print")=true Then If False - not sure Call insertData End If Set NewSheet = Worksheets.Add NewSheet.Name = "Print" Call InsertData I know the code above in nonsense but it should help the Macro guru's come up with the cunning solution to my problem, hopefully. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Does Sheet exist? If True Use If False Create
Rowan Drummond you are indeed an Excel Guru. Thank You -- Shake ------------------------------------------------------------------------ Shake's Profile: http://www.excelforum.com/member.php...o&userid=28577 View this thread: http://www.excelforum.com/showthread...hreadid=483011 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What's the best way to toggle between true and false in Excel? Hiall, My excel work involves a lot of toggling between true and false (booleantypes) ... and it's very repetitive... Is there a way to select a bunch ofcells, and press a key short-cu | Excel Discussion (Misc queries) | |||
Search for 2 true arguments and return true or false | Excel Discussion (Misc queries) | |||
I need to create a simple checkbox that has true false outputs | Excel Discussion (Misc queries) | |||
Function to return True/False if all are validated as True by ISNU | Excel Worksheet Functions | |||
True Or False, no matter what... it still displays the false statement | Excel Programming |