Create new sheet based on cell value

C

Chulius Caesar

I have a sheet which uses query table to download several differen
tables of stock data onto a temporary sheet "Raw Data" based on inpu
stock code on main "sheet1".

Basically I need a code to create a new sheet with the name of the stoc
code from "sheet1".

However, I want it to search through all the existing sheets, and i
that sheet exists already (i.e has been searched previously) then I wan
that to become the active sheet. I will then append the data to the en
of existing data on that sheet
 
D

Don Guillett

I have a sheet which uses query table to download several different
tables of stock data onto a temporary sheet "Raw Data" based on input
stock code on main "sheet1".

Basically I need a code to create a new sheet with the name of the stock
code from "sheet1".

However, I want it to search through all the existing sheets, and if
that sheet exists already (i.e has been searched previously) then I want
that to become the active sheet. I will then append the data to the end
of existing data on that sheet.

You can use something like this. If desired send your file to ME.

Dim WantedSheet As String
WantedSheet = Trim(ActiveCell.Value)
If WantedSheet = "" Then Exit Sub
On Error Resume Next
If Sheets(ActiveCell.Value) Is Nothing Then
MsgBox "Worksheet " & WantedSheet & " was not found, use RClick on " _
& "Sheet Tab Navigation arrow in lower left corner " _
& "to find desired sheetname."
Else
Sheets(ActiveCell.Value).Select
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top