How to update multiple worksheets thru spreadsheet in userform

HYKE

Active Member
Joined
Jan 31, 2010
Messages
373
Hi there again EXCEL Guru's,

I have seen this code just last night and I am somewhat impressed at how a spreadsheet can be used to show worksheet data's on the userform. I am however wondering if it is possible to show and update mulitples worksheets in workbook using the spreadsheet in userform.

I am using this code but is somehow just showing me 1 worksheet. How should this be coded that when I select other worksheet thru the combobox that it will activate the selected worksheet and show it in the userform's spreadsheet.
Code:
Private Sub Spreadsheet1_SheetChange(ByVal Sh As OWC10.Worksheet, ByVal Target As OWC10.Range)
ThisWorkbook.Worksheets("BPME").Range(Target.Address).Value = Target.Value
End Sub

this is my code for combobox
Code:
Private Sub Oft_Change()
    Select Case Oft
        Case "BPME"
        Worksheets("BPME").Select
        'Worksheets("CONSOLIDATED").Select
        Me.Spreadsheet1.Cells.Range("A1:AJ10").Value = ThisWorkbook.Worksheets("BPME").Range("A1:AJ10").Value
        
        Case "EXXON MOBIL"
        Worksheets("EXXONMOBIL").Select
        Me.Spreadsheet1.Cells.Range("A1:AJ10").Value = ThisWorkbook.Worksheets("EXXONMOBIL").Range("A1:AJ10").Value
        'Me.Spreadsheet1.Refresh
        Case "EMARAT"
        Worksheets("EMARAT").Select
    End Select
End Sub

Thanks again for your help guys.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi Again,

I have been browsing the net for hours now and still did not get any positive result on what I desire to happen. I tried to code this, but still is not giving me the desired result.
Code:
Private Sub Oft_Change()
    Select Case Oft
        Case "BPME"
        Worksheets("BPME").Select
        'Worksheets("CONSOLIDATED").Select
        Me.Spreadsheet1.Sheets("Sheet1").Range("A1:AJ10").Value = ThisWorkbook.Worksheets("BPME").Range("A1:AJ10").Value
        
        Case "EXXON MOBIL"
        Worksheets("EXXONMOBIL").Select
        Me.Spreadsheet1.Sheets("Sheet2").Range("A1:AJ10").Value = ThisWorkbook.Worksheets("EXXONMOBIL").Range("A1:AJ10").Value
        Me.Spreadsheet1.Sheets("Sheet2").Refresh
        Case "EMARAT"
        Worksheets("EMARAT").Select
        Me.Spreadsheet1.Sheets("Sheet3").Range("A1:AJ10").Value = ThisWorkbook.Worksheets("EMARAT").Range("A1:AJ10").Value
        Me.Spreadsheet1.Sheets("Sheet3").Refresh
    End Select
End Sub

Any help I will greatly appreciate.

Thanks,

HYKE
 
Upvote 0
Hi Again,

I somehow beginning to make the code work the way I want but I am stuck with error runtime 5 invalid procedure call or argument. could you guys help me on this.

Code:
Private Sub Oft_Change()
    Select Case Oft
        Case "BPME"
        Worksheets("BPME").Select
        'Worksheets("CONSOLIDATED").Select
        Me.Spreadsheet1.Sheets("Sheet1").Range("A1:AJ10").Value = ThisWorkbook.Worksheets("BPME").Range("A1:AJ10").Value
        Me.Spreadsheet1.Sheets("Sheet1").Activate
        Me.Spreadsheet1.Sheets("Sheet1").Name = "BPME"
        Case "EXXON MOBIL"
        Worksheets("EXXONMOBIL").Select
        Me.Spreadsheet1.Sheets("Sheet2").Range("A1:AJ10").Value = ThisWorkbook.Worksheets("EXXONMOBIL").Range("A1:AJ10").Value
        Me.Spreadsheet1.Sheets("Sheet2").Activate
        Me.Spreadsheet1.Sheets("Sheet2").Name = "EXXONMOBIL"
        Case "EMARAT"
        Worksheets("EMARAT").Select
        Me.Spreadsheet1.Sheets("Sheet3").Range("A1:AJ10").Value = ThisWorkbook.Worksheets("EMARAT").Range("A1:AJ10").Value
        Me.Spreadsheet1.Sheets("Sheet3").Activate
        Me.Spreadsheet1.Sheets("Sheet3").Name = "EMARAT"
    End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top