Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2003 - using VBA to post to alternative worksheets
I have a complicated macro which posts a series of entries to a
worksheet called "expenses" but I am sending a copy of some sheets of this workbook to all the staff for completion - but it does not include the worksheet "expenses" but it does include a blank worksheet called "expenses_new". My question is can I adapt this macro so that if the worksheet "expenses" exists then the macro will make all the entries in that worksheet - but if it does not exist then all the entries will be posted to "expenses_new". Basically what I would like to do is find the VBA coding as follows:- If worksheet "expenses" exists then post all entries to "expenses" ELSE post all entries to "expenses.new" Will this work and how do I code it Thanks BJ? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Excel 2003 - using VBA to post to alternative worksheets
Use
Dim flag As Boolean flag = False For Each wksheet In Application.Worksheets If wksheet.Name = "expenses" Then flag = True Exit For End If Next wksheet If flag Then 'set output to expenses Else 'set output to expenses_new End If "BJ&theBear" wrote: I have a complicated macro which posts a series of entries to a worksheet called "expenses" but I am sending a copy of some sheets of this workbook to all the staff for completion - but it does not include the worksheet "expenses" but it does include a blank worksheet called "expenses_new". My question is can I adapt this macro so that if the worksheet "expenses" exists then the macro will make all the entries in that worksheet - but if it does not exist then all the entries will be posted to "expenses_new". Basically what I would like to do is find the VBA coding as follows:- If worksheet "expenses" exists then post all entries to "expenses" ELSE post all entries to "expenses.new" Will this work and how do I code it Thanks BJ? . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
no worksheets in a workbook - Excel 2003 | Excel Discussion (Misc queries) | |||
Alternative for =countifs (in 2007) for Excel 2003 | Excel Discussion (Misc queries) | |||
I need alternative formula for SUMIFS in Excel 2003 | Excel Worksheet Functions | |||
How do I combine two worksheets in EXCEL 2003 | Excel Discussion (Misc queries) | |||
Excel 2003 Worksheets | Excel Discussion (Misc queries) |