Unload Me interferes with vba

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
291
I have the following macro which works perfect except... after selecting an item and loading it into the next available cell I need the userform to vanish, so I put the Unload Me at the end, without Unload Me the combobox puts the data in the nest available cell and stays on the screen , select another and it faithfully puts it into the next available cell ad infinitum, when I put Unload Me, in the cell does not receive any data but the userform vanishes, any suggestions, perhaps there is a better way to make the userform disappear once it has been used
Rich (BB code):
Private Sub cmdAddPart_Click()
Dim adr As String
Dim ws As Worksheet
Set ws = Worksheets("ORDER INPUT")
    ' find blank cell
    'Dim adr As String
   
  Range("c10").Select
     Do
         If IsEmpty(ActiveCell) = False Then
         ActiveCell.Offset(1, 0).Select
         End If
     Loop Until IsEmpty(ActiveCell) = True
 
    ' load addr with blank cell reference
  adr = ActiveCell.Address(ReferenceStyle:=xlA1)
    With cboPart
        .ControlSource = adr
    End With
 
    Unload Me
End Sub
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

vaskov17

Well-known Member
Joined
Apr 27, 2011
Messages
920
have you tried:

Code:
activecell=cbopart.value

instead of:

Code:
' load addr with blank cell reference
  adr = ActiveCell.Address(ReferenceStyle:=xlA1)
    With cboPart
        .ControlSource = adr
    End With
 

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
291
thanks Vaskov17,
I have now , works well thank you,
now it's created another problem, which is off topic so I'll look into tonight and ask another question
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,255
Messages
5,769,067
Members
425,515
Latest member
baltusf

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
Top