Open UserForm and show result from another sheet

FryGirl

Well-known Member
Joined
Nov 11, 2008
Messages
1,368
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a Userform which is activated with the double clicking of a specific column. All this is working, but what I need is to have TextBox2 reference a cell off of another sheet.

Not sure how to reference the other sheet. TextBox1 will show the current activecell contents on the activesheet, but TextBox2 should show the contents of what is on Shee2.

Code:
Private Sub UserForm_Activate()
    Me.TextBox1.ControlSource = ActiveCell.Parent.Name & "!" & ActiveCell.Address
    Me.TextBox2.ControlSource = ActiveCell.Offset(, 5).Parent.Name & "!" & ActiveCell.Offset(, 5).Address
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Is this what you want
TextBox1 = active cell value (eg A1)
TextBox2 = same cell in other sheet offset 5 columns (= F1)

Code:
Private Sub UserForm_Activate()
    Dim cel As Range: Set cel = ActiveCell
    Me.TextBox1.Value = cel.Value
    Me.TextBox2.Value = Sheets("OtherSheetName").Range(cel.Address).Offset(, 5).Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,883
Messages
6,175,167
Members
452,615
Latest member
bogeys2birdies

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