Userform to show when cell value is changed

Sharonca

New Member
Joined
Jan 9, 2022
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello,
My userform is not showing when I change a value in any cell in column DF. What am I doing wrong?

My code is as follows:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rangeToChange As Range

If Target = Range("DF:DF").Address Then
Load UserForm1
UserForm1.Show

End If
If Not Intersect(Target, Range("DF:DF")) Is Nothing Then
End If
End Sub
 

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
This line is no good:
VBA Code:
If Target = Range("DF:DF").Address Then

Use the INTERSECT method like you did below:
VBA Code:
If Not Intersect(Target, Range("DF:DF")) Is Nothing Then
    UserForm1.Show
End If
 
Upvote 0
I am getting a run-time error-2147352375
Could not set the value property. Type mismatch.
The UserForm1.Show line is highlighted in yellow when I change the value in any cell in column DF. I need to load corresponding data into the form before it shows.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim rangeToChange As Range

If Not Intersect(Target, Range("DF:DF")) Is Nothing Then
UserForm1.Show
End If

End Sub
 
Upvote 0
I am getting a run-time error-2147352375
Could not set the value property. Type mismatch.
The UserForm1.Show line is highlighted in yellow when I change the value in any cell in column DF. I need to load corresponding data into the form before it shows.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim rangeToChange As Range

If Not Intersect(Target, Range("DF:DF")) Is Nothing Then
UserForm1.Show
End If

End Sub
OK, then just do whatever it is that you normally do in order to load that data (is that what the "Load UserForm1" line is supposed to do?).

The important thing I was showing you was how to change your "If ... Then" statement.
 
Upvote 0
You are welcome.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

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