LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Loop ?

Also consider this, as long as it's OK to change the activecell (note that,
in this example and the others, the if is not necessary and just adds
processing, since, in the end, you're just making the column B value equal to
the column C value regarless.):

Range("B5").Select
Do Until ActiveCell.Value = ""
ActiveCell.Value = ActiveCell.Offset(0,1).Value
ActiveCell.Offset(1, 0).Select
Loop



"Mike" wrote:

Can someone tell how or what i need to do with this code so that it will
start in Column B and compare with Column C and do this until the last row in
column B
Right now the code only compare's B5 with C5 and i need it to compare
B6 with C6, B7 with C7 and so on till the last row in column B

Thanks for any help!

Option Explicit

Sub priceComparison()
Const priceCompSheetName = "Price Comparison"
Const ourPriceCol = "B"
Const alltelPriceCol = "C"
Dim pcWS As Worksheet

Set pcWS = Worksheets(priceCompSheetName)

If pcWS.Range(ourPriceCol & "5").Value _
< pcWS.Range(alltelPriceCol & "5").Value Then
pcWS.Range(ourPriceCol & "5").Value _
= pcWS.Range(alltelPriceCol & "5").Value
End If
End Sub



 
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
Naming Worksheets - Loop within a loop issue klysell Excel Programming 5 March 29th 07 05:48 AM
Naming Worksheets - Loop within a loop issue klysell Excel Programming 0 March 27th 07 11:17 PM
(Complex) Loop within loop to create worksheets klysell Excel Programming 1 March 20th 07 12:03 AM
Advancing outer Loop Based on criteria of inner loop ExcelMonkey Excel Programming 1 August 15th 05 05:23 PM
Problem adding charts using Do-Loop Until loop Chris Bromley[_2_] Excel Programming 2 May 23rd 05 01:31 PM


All times are GMT +1. The time now is 01:07 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"