Userform loading

DGP

New Member
Joined
May 11, 2022
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Complete novice here so sorry if im not using the correct terminology.

I have a worksheet that I have created 2 userforms for, UserForm1 I want to load if the current row being used in column O states "parts oversized" or "parts undersized" and UserForm2 is the same apart from column Q states "parts overweight" or "parts underweight". This worksheet will be used as a database for results so I don't want it to trigger the UserForms on old rows, if that is possible?

I have the Userforms adding the additional data to the worksheet, but i can not get them to load if columns O or Q contain the text above, I don't know if its because columns O and Q are filled by an IF formula.

Any help would be greatly appreciated, code for loading userform below.

VBA Code:
Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cell As Range
For Each cell In Range("O:O")
    If cell.Value = "Part Underweight" Then
        UserForm1.Show
    If cell.Value = "Part Overweight" Then
        UserForm1.Show
    End If
Next cell
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I don't want it to trigger the UserForms on old rows, if that is possible?
It is possible, but what data tells you if a row is an "old row"? It would be helpful to show us what the data looks like.

Also, your code will run every time you merely select any cell on the sheet. I doubt that is what you intended.

Then it will check every cell in column O, but you said you don't what to check "old rows."

Also you are showing UserForm2 for underweight/overweight, but in your post you said you wanted to use UserForm1 for this situation.

If you just want to monitor when something in column O changes, it will be difficult because you said this is a formula. It is possible, just difficult. There is no event that fires when the result of a particular formula changes. The Calculate event will fire when something on the sheet is updated that causes a calculation, but it won't tell you what changed.
 
Upvote 0

Forum statistics

Threads
1,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

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