Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Which commands to use in a macro

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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set of Macro commands Rechie Excel Discussion (Misc queries) 1 August 17th 09 11:37 AM
Macro Commands Chris Premo Excel Discussion (Misc queries) 6 January 1st 09 04:35 PM
Macro Commands danh Excel Discussion (Misc queries) 5 June 22nd 06 02:00 PM
macro commands Amir Excel Discussion (Misc queries) 2 April 3rd 06 10:58 AM
what are macro commands for... J_J[_2_] Excel Programming 3 January 25th 06 12:17 PM


All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"