Userform Refresh Error!!!!

nightcrawler23

Well-known Member
Joined
Sep 24, 2009
Messages
721
hi all,
i have a userform with a listboz and few buttons
i wanted to update the listbox whenever a new cell is selected.
i couldn't figure out the way so i just unload the form and reload it using the below code.

Code:
Sub formRefresh()
Application.ScreenUpdating = False
Unload frmPropList
frmPropList.Show
Application.ScreenUpdating = True
End Sub

Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If frmPropList.Visible = True Then
    formRefresh
End If
End Sub

The problem is every time a change selection the form goes off and comes back which looks odd. also the position is always center of the screen even if i change it.

Is there a way to come over it. Or is there another way to accomplish the same thing.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Off to the rack for me (well overdue), but for others... Care to share the form's code?
 
Upvote 0
Off to the rack for me (well overdue), but for others... Care to share the form's code?

Didnt quite get you...My userform just has a listbox and the code is to populate the listbox.

Code:
Private Sub UserForm_Initialize()
Dim listProperties() As Variant
Dim propSh As Worksheet
listProperties = getProperties  'gets the 1st column elements

With Me.lbPropList
    .Clear
    If UBound(listProperties) > 0 Then
        For i = 1 To UBound(listProperties)
            Set propSh = Sheets(ActiveSheet.CodeName & "_" & listProperties(i))
            .AddItem listProperties(i): [COLOR="Red"].List(i - 1, 1) = propSh.Range(ActiveCell.Address).Value[/COLOR] ' line in red gets the 2nd column element
        Next i
        Else
        .AddItem "NO PROPERTIES DEFINED"
    End If
        .ListIndex = 0 ' select the first item
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,735
Members
452,939
Latest member
WCrawford

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