C
Carolyn
Can someone please help? I am very new to coding excel and am running
into problems constantly. I am on a tight deadline and am frightened
I am not going to make it. I am trying to copy the entire row from
one sheet to a master if the value in one of the columns is greater
than zero. I have read through all the postings I can find on the
subject - which has been helpful. The code that I have come up with
is copying everything. Also, how would I get the copied cells to
start in a row other than 1? I need to put additional reference
information in the beginning of the sheet.
I have a command button at the bottom of the sheet - which is named
chemicals - that is to start the macro.
Private Sub CommandButton1_Click()
myObject = Range("chemcounts")
Set myObject = Range("chemcounts")
Range("chemcounts").Select
Selection.Copy
Dim msg As String
msg = "Your order has been sent to the order form"
MsgBox (msg)
Dim Sh1 As Worksheet, Sh2 As Worksheet
Dim rng1 As Range, Cell As Range
Dim DestRow As Long
Set Sh1 = Worksheets("Chemicals")
Set Sh2 = Worksheets("Master")
DestRow = 1
Set rng1 = Sh1.Range("A1").CurrentRegion
Set rng1 = Intersect(rng1, Sh1.Columns(5))
' move range to start in row 2
Set rng1 = rng1.Offset(1, 0). _
Resize(rng1.Rows.Count - 1)
For Each Cell In rng1
If UCase(Cell.Value) > 0 Then
Cell.EntireRow.Copy _
Destination:=Sh2.Cells(DestRow, 1)
DestRow = DestRow + 1
End If
Next Cell
Thank you in advance for any help.
Carolyn
into problems constantly. I am on a tight deadline and am frightened
I am not going to make it. I am trying to copy the entire row from
one sheet to a master if the value in one of the columns is greater
than zero. I have read through all the postings I can find on the
subject - which has been helpful. The code that I have come up with
is copying everything. Also, how would I get the copied cells to
start in a row other than 1? I need to put additional reference
information in the beginning of the sheet.
I have a command button at the bottom of the sheet - which is named
chemicals - that is to start the macro.
Private Sub CommandButton1_Click()
myObject = Range("chemcounts")
Set myObject = Range("chemcounts")
Range("chemcounts").Select
Selection.Copy
Dim msg As String
msg = "Your order has been sent to the order form"
MsgBox (msg)
Dim Sh1 As Worksheet, Sh2 As Worksheet
Dim rng1 As Range, Cell As Range
Dim DestRow As Long
Set Sh1 = Worksheets("Chemicals")
Set Sh2 = Worksheets("Master")
DestRow = 1
Set rng1 = Sh1.Range("A1").CurrentRegion
Set rng1 = Intersect(rng1, Sh1.Columns(5))
' move range to start in row 2
Set rng1 = rng1.Offset(1, 0). _
Resize(rng1.Rows.Count - 1)
For Each Cell In rng1
If UCase(Cell.Value) > 0 Then
Cell.EntireRow.Copy _
Destination:=Sh2.Cells(DestRow, 1)
DestRow = DestRow + 1
End If
Next Cell
Thank you in advance for any help.
Carolyn