Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 271
Default Loop Formula


I have a range of cells lets say A1:B10. In Column B, there is an "x" every
so often. I need a macro that will look down Column B1:B10 and for every
time there is an "x" copy what is in the adjacent cell in Column A to Sheet1
cell A1 then A2 then A3 etc.

Please helpt.


--
Thanks
Shawn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Loop Formula

Sub CopyData()
Dim rng as Range, cell as Range
dim rw as Long
set rng = Worksheets("Sheet2").Range("B1:B10")
rw = 1
for each cell in rng
if lcase(cell.value) = "x" then
worksheets("Sheet1").Cells(rw,"A") = cell.offset(0,-1)
rw = rw + 1
end if
Next
End sub

--
Regards,
Tom Ogilvy



"Shawn" wrote:


I have a range of cells lets say A1:B10. In Column B, there is an "x" every
so often. I need a macro that will look down Column B1:B10 and for every
time there is an "x" copy what is in the adjacent cell in Column A to Sheet1
cell A1 then A2 then A3 etc.

Please helpt.


--
Thanks
Shawn

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
loop a list with the IF formula ufo_pilot Excel Discussion (Misc queries) 1 January 21st 08 10:10 PM
Loop excel formula magix Excel Programming 2 May 13th 07 04:11 PM
How can I loop through all Formula in a workbook? Peter Excel Programming 5 April 4th 06 06:12 AM
Loop for a Complex Formula monir Excel Programming 3 March 26th 05 07:37 PM
Loop within Excel Formula? Dan[_29_] Excel Programming 3 December 23rd 03 10:26 PM


All times are GMT +1. The time now is 12:17 PM.

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

About Us

"It's about Microsoft Excel"