TAB STRIP CODE

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I AM TRYING TO WRITE VBA CODE FOR A TAB STRIP THAT CONTAINS FOUR TABS WITH
THE SELECTION TO BE DISPLAYED IN A GIVEN CELL LOCATION. CAN ANYONE HELP ME
OUT?
 
Hi,

the attached code will insert 3 worksheets to your workbook and rename
them based on the contents of cells A1:A3 of your active sheet. The
code is basic but it should put you in the right direction.

Sub InsertSheets()
'
Dim WsCurrent As Worksheet

Set WsCurrent = ActiveSheet
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = WsCurrent.Range("A1").Value
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = WsCurrent.Range("A2").Value
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = WsCurrent.Range("A3").Value
End Sub

HTH

Fadi
www.chalouhis.com/XLBLOG
 
Private Sub TabStrip1_Change()
Call TabStrip1_Click(TabStrip1.SelectedItem.Index)
End Sub

Private Sub TabStrip1_Click(ByVal Index As Long)
Sheets(1).Range("C14").Value = TabStrip1.SelectedItem.Index
Sheets(1).Range("C15").Value = TabStrip1.SelectedItem.Caption
End Sub

HTH. Best wishes Harald
 

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

Back
Top