Unload Me interferes with vba

hitch_hiker

Active Member
Joined
Feb 21, 2012
Messages
294
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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,216
Members
448,876
Latest member
Solitario

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