error codigo1004

magoba

Board Regular
Joined
Aug 1, 2004
Messages
71
Office Version
  1. 2016
Platform
  1. Windows
Saludos a Todos, tengo este codigo para un formulario al hacer click en el boton 2 me sale el error codigo 1004, el codigo en cuestion es el siguiente

Private Sub UserForm_initialize()
Dim combo_item As String

Application.ScreenUpdating = False

Sheets("DATOS").Select
Range("AB6").Select
Do While ActiveCell <> ""
combo_item = ActiveCell.Value
ComboBox1.AddItem combo_item
ActiveCell.Offset(1, 0).Select
Loop
Application.ScreenUpdating = True
End Sub

Private Sub CommandButton2_Click()
Application.ScreenUpdating = False

Sheets("DATOS").Select
Range("A30").Select
Selection.End(x1UP).Select AQUI SE DETIENE LA MACRO
ActiveCell.Offset(1, 0).Select


ActiveCell = ComboBox1.Value
ActiveCell.Offset(0.1).Select
Application.ScreenUpdating = True

End Sub


Private Sub CommandButton1_Click()
Range("A2").Select
ActiveWorkbook.Save
UserForm1.Hide
End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hola, and that's all my Spanish!

You need:
Code:
Selection.End(xlUP).Select

Note: XLUP and not X1UP
 
Upvote 0
Tank you Rorya but as you can see in my post thats the way it is written
 
Upvote 0
No - you have X1UP. It must be XLUP.
 
Upvote 0
You are correct my mistake, now the code works as written
Tank you very much Rorya
 
Upvote 0

Forum statistics

Threads
1,223,950
Messages
6,175,584
Members
452,653
Latest member
craigje92

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