I have a combobox attached to a userform which I'm using to populate the value of cell A1 on a worksheet named "data".
Could someone help me out with the VBA for activating the worksheet named in this Data!A1 cell please?
I have a combobox attached to a userform which I'm using to populate the value of cell A1 on a worksheet named "data".
Could someone help me out with the VBA for activating the worksheet named in this Data!A1 cell please?
Last edited by Janc; 02-26-2015 at 03:54 PM. Reason: Solved. Thank you.
Try this sample workbook
Maybe?
![]()
Sub Janc() Sheets(Sheets("Data").Range("A1").Value).Activate End Sub
Simple and effective .. Great line of code
Thanks both very much - I needed a combination of both of your replies to fully solve my issue, so you helped further than I was anticipating![]()
When an option is chosen from my combobox, the cell on Data!A1 updates with the value form the combobox with this code:
![]()
Private Sub OKButton_Click() Sheets(Sheets("Data").Range("A1").Value).Activate End Sub
But I had omitted this very important part for when the list within the combobox is changed:
![]()
Private Sub cboName_Change() Dim strValue As String strValue = cboName.Value Worksheets("Data").Range("A1") = strValue End Sub
I'm posting this code for my own future reference as well as to help others.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks