PDA

View Full Version : Adding worksheets



taporctv
06-28-2007, 01:22 PM
I have a procedure that creates a new worksheet based on what was chosen in a list box. I have somethings I'd like to do.

1. Add the worksheet to the the right of the last worksheet.
2. The worksheet is the name of a column in my bar chart. I want the worksheet the same color as its corresponding series in the bar chart.
3. Then when the option in chosen, I'd like to delete all worksheets except the main one.

Simon Lloyd
06-29-2007, 03:50 AM
taporctv, practically everything you want to do in this thread can be achieved by using the macro recorder and adjusting the code to suit i.e change names and colours etc.

lucas
06-29-2007, 06:38 AM
I have a procedure that creates a new worksheet based on what was chosen in a list box. I have somethings I'd like to do.
Why don't you post this code that you have so that we don't have to create something that may not be anything like what you have started with?

taporctv
07-03-2007, 06:11 AM
I got bullets 1 & 3 to work. Im still struggling to find out how to do number 2. Is it possible to get the color properties of a certain series on the chart and assign that color to the worksheet? As of now I have now code for that.

taporctv
07-09-2007, 07:19 AM
How would I check to see if a particular worksheet already exists?

Bob Phillips
07-09-2007, 07:20 AM
'-----------------------------------------------------------------
Function SheetExists(Sh As String, _
Optional wb As Workbook) As Boolean
'-----------------------------------------------------------------
Dim oWs As Worksheet
If wb Is Nothing Then Set wb = ActiveWorkbook
On Error Resume Next
SheetExists = CBool(Not wb.Worksheets(Sh) Is Nothing)
On Error GoTo 0
End Function