LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA - looping help

Hi again,
sorry ive posted twice today for VBA help. im very new to VBA so im seeking help where i can.
I have a spreadhseet with the following columns:
Code - A1
Name - Uppercase - B1
Name - Lowercase - C1
Title - D1
Status - E1

Now i need to create a simple loop that checks column E (status) for a status of "CONS". If the cell contains the word CONS then it will ignore that row and move onto the next row.If it doesnt contain the word "CONS" then it will copy cell C1 into B1 and uppercase THEN let me paste a code into cell A1.
Once this row is complete, it will need to go down to the next row, again pasting to cell A2 etc until there is no data left in column E

Can this be done easily?
I attempted this but failed miserably, my code is:

Sub TestEachLine()

Dim c As Range
For Each c In Range("E2:E20")

If c.Value = "CONS" Then
Next c
Else
Range("B2").Select
ActiveCell.FormulaR1C1 = "=UPPER(RC[1])"
Range("A2").Select
ActiveCell.FormulaR1C1 = "ConsCode"
End If

Next c
End Sub

Please dont be harsh on the code, im very new to this and still trying to learn. the "ConsCode" is just an example of what will be inserted, it will be a code calculated elsewhere so "ConsCode" is just a temp value for test purposes.
Thank you all again, and sorry to bug you twice in one day.
Adam


Submitted via EggHeadCafe - Software Developer Portal of Choice
VIsual Studio.NET 2005 / SQL 2005 Resources
http://www.eggheadcafe.com/tutorials...net-2005-.aspx
 
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
Looping Maggie[_6_] Excel Discussion (Misc queries) 6 October 2nd 08 09:14 PM
Looping Bob Phillips Excel Programming 0 January 11th 07 04:12 PM
Looping Hannes Excel Programming 3 December 27th 04 09:03 PM
Looping Andrew Clark[_2_] Excel Programming 1 December 20th 03 05:01 PM
Looping Syd[_4_] Excel Programming 1 December 11th 03 11:17 PM


All times are GMT +1. The time now is 02:55 AM.

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"