PDA

View Full Version : Choose Invoice Number from a userform combobox and copy data to invoice output



djemy1975
04-07-2016, 12:31 AM
Dear Developpers,


Please help me to be able to copy data from sheet ("BDD") to invoice Output("Facture Simple")via userform combobox by choosing invoice number and copy the whole non blank range with a copy


button. I have a piece of code given by "p45cal"(special thanks for him), which works correctly but by selecting the range to be copied with "ActiveCell.Row" method.What I want is to modify that code in order to be able to use it from userform without accessing the sheet.

Here is the code I want to modify:

Private Sub CommandButton2_Click()
rw = ActiveCell.Row
Sheets("BDD").Range("C" & rw & ":E" & rw & ",H" & rw & ":I" & rw).Copy
Sheets("Facture Simple").Range("D18").PasteSpecial Paste:=xlPasteValues
destnRw = 19
For colm = 13 To 58 Step 5
If Len(Sheets("BDD").Cells(rw, colm + 4).Value) > 0 Then
Sheets("BDD").Cells(rw, colm).Resize(, 5).Copy
Sheets("Facture Simple").Range("D" & destnRw).PasteSpecial Paste:=xlPasteValues
destnRw = destnRw + 1
End If
Next colm
Application.CutCopyMode = False
End Sub




Herewith my file to work on:

Thanks in advance,

djemy1975
04-07-2016, 08:31 AM
HEREWITH MY FILE MODIFIED WITH CODE ADDED