Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello to All,
Please help. I copied a VBA Code from a site that is almost perfect for what I want it to do. The only issue is I want it to copy a row if the $ value of column D is between two $ amounts. For this line, €˜If Range("D" & CStr(LSearchRow)).Value is 199.99 to 399.99 Then, I get an error box and it selects €˜to. Can somebody show me whats wrong so I can achieve my goal? Here is the code: Sub SearchForString() Dim LSearchRow As Integer Dim LCopyToRow As Integer On Error GoTo Err_Execute LSearchRow = 4 LCopyToRow = 2 While Len(Range("D" & CStr(LSearchRow)).Value) 0 If Range("D" & CStr(LSearchRow)).Value is 199.99 to 399.99 Then Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select Selection.Copy Sheets("0-99").Select Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select ActiveSheet.Paste LCopyToRow = LCopyToRow + 1 Sheets("MultAdjDaily").Select End If LSearchRow = LSearchRow + 1 Wend Application.CutCopyMode = False Range("A3").Select MsgBox "All matching data has been copied." Exit Sub Err_Execute: MsgBox "An error occurred." End Sub Please help. -- Cue |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy and paste versus copy and insert copied cells | New Users to Excel | |||
I copy a formula and the results copy from the original cell | Excel Discussion (Misc queries) | |||
copy between worksheets does not copy formulae just values | Excel Discussion (Misc queries) | |||
Copy/Paste how to avoid the copy of formula cells w/o calc values | Excel Discussion (Misc queries) | |||
EXCEL FILE a copy/a copy/a copy ....filename | New Users to Excel |