Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Guessing a bit
Sub CopyData() Dim oRow As Range Dim rng As Range Dim i As Long For Each oRow In ActiveSheet.UsedRange.Rows If Cells(oRow.Row, "E").Value = 0 Then i = i + 1 Cells(oRow.Row, "C").Copy Worksheets("Sheet2").Range("A" & i) Cells(oRow.Row, "H").Copy Worksheets("Sheet2").Range("B" & i) Cells(oRow.Row, "J").Copy Worksheets("Sheet2").Range("C" & i) End If Next oRow End Sub -- HTH Bob Phillips (remove nothere from the email address if mailing direct) "Alok" wrote in message ... Hi, I want to use a macro in a worksheet. In the worksheet, I have to select only some columns, not all. Now, the number of rows are also refreshed daily in that sheet. I have to apply conditions also in that macro for selecting the particular rows. Can I use if statement in the VB editor, and what command should i use with if to select a particular cell? Activecell? For example, I have to select column 3, 8 and 10 and check for all rows which have a value in column 5 equal to 0. Then I have to copy these rows in another sheet. Please help me out. Thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Set of Macro commands | Excel Discussion (Misc queries) | |||
Macro Commands | Excel Discussion (Misc queries) | |||
Macro Commands | Excel Discussion (Misc queries) | |||
macro commands | Excel Discussion (Misc queries) | |||
what are macro commands for... | Excel Programming |