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: 23
Default Macro Help - Loops

I'm trying to set up a macro to help search through a column of numbers to
find out which two (or more) add to an input number, and then show the
numbers in a box. I'm starting with a basic loop that I've used before and
I can't get it past the Do While point.

Can anyone tell me what I'm missing?

Sub Find_Combos_That_Add_to_Input_Value()

'Start at the currently selected cell
Dim x As Integer

x = ActiveCell.Row
'Loop

Do While Cells(x, 0).Value < ""

'If the values of the first row plus the next row equal the
input number
'show the message, otherwise go to the next row until the end

If (Cells(0, 0).Value + Cells(x, 0).Value = 5) Then

MsgBox ("Values are" & Cells(0, 0).Value & "and" & Cells(x, 0).Value)

Else
'increase the value of rownum by 1 to move the loop starting
point to the next row

End If

x = x + 1

Loop

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
Excel macro/vba loops sammy Excel Programming 1 February 15th 05 05:09 PM
macro that loops till end of worksheet Nadiya Excel Programming 2 November 10th 04 05:36 PM
Vlookup macro that returns data from worksheet, then Loops xlsxlsxls[_3_] Excel Programming 4 October 23rd 04 05:48 PM
copying areas and macro loops dynamicsoul Excel Programming 3 September 12th 03 09:43 PM
macro that loops to multiple columns Brad Zenner Excel Programming 1 July 22nd 03 03:17 AM


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