New line activates combobox aflterchange

miami2k

Board Regular
Joined
Nov 1, 2017
Messages
58
I have this code... when I click CommandButton1 it does what it is suppsed to do but after the command
Selection.Insert Shift:=xlDown

the code goes to
Private Sub CMBCliente_Change()

______________________________________

Private Sub CMBCliente_Change()


'Trova riga cliente
Dim Clienti As Worksheet
Set Clienti = Sheets("Clienti")
Set Cerca = Clienti.Range("B:B").Find(What:=Me.CMBCliente.Value)
Dim RigaCliente As Variant
RigaCliente = Cerca.Row


'Copia dati
Dim BConf As Worksheet
Set BConf = Sheets("BConfirmation")
BConf.Cells(10, 6) = Clienti.Cells(RigaCliente, 2)
BConf.Cells(11, 6) = Clienti.Cells(RigaCliente, 3)
BConf.Cells(12, 6) = Clienti.Cells(RigaCliente, 4)
BConf.Cells(13, 6) = Clienti.Cells(RigaCliente, 5)
BConf.Cells(13, 7) = Clienti.Cells(RigaCliente, 6)
BConf.Cells(14, 6) = Clienti.Cells(RigaCliente, 7)
BConf.Cells(15, 6) = Clienti.Cells(RigaCliente, 8)


End Sub
______________________________________

Private Sub CommandButton1_Click()


' Inserisci_riga Macro


Dim nr As Integer
nr = 33
Do Until Cells(nr, 1).Value = ""
nr = nr + 1


Loop


Set BCSheet = ThisWorkbook.Sheets("BConfirmation")
ActiveSheet.Unprotect "123"
Sheets("Foglio1").Visible = True
Sheets("Foglio1").Select
Sheets("Foglio1").Range("4:4").Copy
Sheets("Foglio1").Visible = xlVeryHidden
Sheets("BConfirmation").Select
Rows(nr).Select
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False
ActiveSheet.Protect "123", True, True


End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
You just do copy, insert down, but forgot to paste.

Code:
[COLOR=#0000cd]Set BCSheet = ThisWorkbook.Sheets("BConfirmation")
ActiveSheet.Unprotect "123"
[/COLOR][COLOR=#a9a9a9]'Sheets("Foglio1").Visible = True
'Sheets("Foglio1").Select[/COLOR][COLOR=#0000cd]
Sheets("Foglio1").Range("4:4").Copy
[/COLOR][COLOR=#a9a9a9]'Sheets("Foglio1").Visible = xlVeryHidden
'Sheets("BConfirmation").Select[/COLOR][COLOR=#0000cd]
[/COLOR][COLOR=#ff0000]BCSheet.Rows(nr).Insert Shift:=xlDown       [/COLOR][COLOR=#a9a9a9]<--- change to this[/COLOR][COLOR=#0000cd]
[/COLOR][COLOR=#a9a9a9]'Selection.Insert Shift:=xlDown[/COLOR][COLOR=#0000cd]
Application.CutCopyMode = False
ActiveSheet.Protect "123", True, True[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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