View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ronald R. Dodge, Jr.[_2_] Ronald R. Dodge, Jr.[_2_] is offline
external usenet poster
 
Posts: 134
Default USEING IF FUNCTION TO COPY IN ANOTHER WORKBOOK

The second argument of the "Cells" property also needs to be a number, which
would be respective to the Nth column of the worksheet, so for column "BD",
it would be a number of 56, which would be the same as the spreadsheet
formula of:

=COLUMN(BD:BD)

One way to redo the Range object is the following:

Dim wshSource as Worksheet, wshDestination as Worksheet, rng as Range, cell
as Range
Set wshSource = Workbooks("Book1").Worksheets("Sheet1")
Set wshDestination = Workbooks("Book2").Worksheets("Sheet1")
Set rng = wshSource.Range("BD91:BD" &
CStr(wshSource.Range("BD65536").End(xlUp).Row))
For Each cell In rng
If cell.Value <= 32 Then
cell.EntireRow.Copy(wshDestination.Range("A" & CStr(cell.Row))
End If
Next

Make adjustments to this as necessary to fit your needs.
--
Thanks,

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"ytayta555" wrote in message
...
Hi

How can I change this macro
If cell.Value <= 32 Then
to activate another workbook
and to copy entire row in this
another workbook ????

Any sugestion is very important
for me

many thanks


Sub Clear_Ranges()

Dim cell As Range, rng As Range
Set rng = Range(Cells(91, "BD"), Cells(Rows.Count,
"BD").End(xlUp))
For Each cell In rng
If cell.Value <= 32 Then
Cells(cell.Row, "C").Select
Selection.Resize(1, 52).Select
Selection.ClearContents
End If
Next

End Sub