Modeless ánd active

Wil Moosa

Well-known Member
Joined
Aug 11, 2002
Messages
893
I have a userform which is modeless.

The labelbox (label1) refers to Activecell.value.

I'm looking for a way where I can use the mouse to select another cell... while the userform is continious in sight... but also updates the text in label1.

I read somewehere that I could use Worksheet_change to get my update but that was more a clue than a clear solution.

Who can help me here?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Is this what you mean?

First show the form modeless, something like this:

Code:
Sub showtheform()
UserForm1.Show vbModeless
End Sub

and then depending on how you want to get the values either the Worksheet SelectionChange event or the Worksheet Change event for the sheet you want to pull values from:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
UserForm1.Label1 = Target.Text
End Sub

or

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
UserForm1.Label1 = Target.Text
End Sub
 
Upvote 0
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PicViewer.Label1 = Target.Text
End sub

Worsk fine, does what it needs to do. Thanks.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PicViewer.Label1 = Target.Text
PicViewer.Image1 = Target.Image
End sub

Should do the same but also should show the corresponding picture (the text is the full path of the picfile). While the text in the label shows the full path of the pic, the pic remains the same. So no reloading.

The strange thing here is when I select with Enter it does work... but everything (also the enter way) jams when I try to select with the mouse.

I could overcome this by hiding and reopening the userform each time but this slows the process down ánd the reloading is less smooth. Am I overlooking something in the reload process here?
 
Upvote 0
Perhaps:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PicViewer.Label1 = Target.Text
PicViewer.Image1.Picture = LoadPicture(Target.Text)
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,390
Members
448,957
Latest member
Hat4Life

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