VBA Help

Muhammad Rizwan

New Member
Joined
Jan 17, 2022
Messages
3
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
  6. 2003 or older
Platform
  1. Windows
Hello Experts
I am using vba code to copy only tick books, its done
but i want to copy invoice number etc. can some one write code for me how to copy invoice number till empty row in sales sheet
Copy Code is here
Sub CopyRows()

For Each chkbx In ActiveSheet.CheckBoxes
If chkbx.Value = 1 Then
For r = 13 To Rows.Count


If Cells(r, 1).Top = chkbx.Top Then
With Worksheets("sales")
LRow = .Range("e" & Rows.Count).End(xlUp).Row + 1
.Range("e" & LRow & ":i" & LRow) = _
Worksheets("Invoice").Range("c" & r & ":g" & r).Value

End With
Exit For
End If
Next r
End If
Next

End Sub
 

Attachments

  • 2.JPG
    2.JPG
    30.9 KB · Views: 5
  • 1.JPG
    1.JPG
    88.9 KB · Views: 5

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
If the invoice No&... are in Range("A1:D1)")
May be
VBA Code:
.
.
.
Worksheets("sales").Range("A2").Resize(LRow, 4) =Worksheets("sales").Range("A1:D1")
End sub
 
Upvote 0
If the invoice No&... are in Range("A1:D1)")
May be
VBA Code:
.
.
.
Worksheets("sales").Range("A2").Resize(LRow, 4) =Worksheets("sales").Range("A1:D1")
End sub
Sir i want to copy only selected rows. If selected rows are 5 invoice numbers must copy 5 time. If selected rows are 7 or 2 invoice number and date etc copied with same selection rows number.
Book name change while copying but invoice numbers same
 
Upvote 0

Forum statistics

Threads
1,214,889
Messages
6,122,097
Members
449,065
Latest member
albertocarrillom

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