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

I'm a programmer, and I've got an excel problem to solve.

To simplify, Imagine I have a sheet as follows

A B C D E
1 car house tree
2 horse table dog
3 bike bat window
4
5

The solution requires me to read every row and then process it

e.g in pseudocode

READ FIRST ROW (car, house, tree)
DO UNTIL END OF SHEET
CALL PROCEDURE (passing the 3 column values as parameters)
READ ROW
LOOP


What I need is some sample code to replace the pseudocode.

Apologies for the beginner question, and any answer is much
appreciated.

cheers
Roshintosh

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default beginner question

One way:

Sub test()
Dim eRow As Long
Dim i As Long
Dim str1 As String
Dim str2 As String
Dim str3 As String
eRow = Cells(Rows.Count, 1).End(xlUp).Row 'finds last used row
For i = 1 To eRow
str1 = Cells(i, 1).Value
str2 = Cells(i, 2).Value
str3 = Cells(i, 3).Value
Call Other(str1, str2, str3)
Next i
End Sub

Sub Other(val1 As String, val2 As String, val3 As String)
MsgBox "Values a " & val1 & ", " & val2 & ", " & val3
End Sub

Hope this helps
Rowan

Roshintosh wrote:
I'm a programmer, and I've got an excel problem to solve.

To simplify, Imagine I have a sheet as follows

A B C D E
1 car house tree
2 horse table dog
3 bike bat window
4
5

The solution requires me to read every row and then process it

e.g in pseudocode

READ FIRST ROW (car, house, tree)
DO UNTIL END OF SHEET
CALL PROCEDURE (passing the 3 column values as parameters)
READ ROW
LOOP


What I need is some sample code to replace the pseudocode.

Apologies for the beginner question, and any answer is much
appreciated.

cheers
Roshintosh

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default beginner question

range("a1").select
while selection.value<""
yourFunction selection.offset(0,0).value, _
selection.offset(0,1).value, _
selection.offset(0,2).value
selection.offset(1,0).select
wend

"Roshintosh" wrote:

I'm a programmer, and I've got an excel problem to solve.

To simplify, Imagine I have a sheet as follows

A B C D E
1 car house tree
2 horse table dog
3 bike bat window
4
5

The solution requires me to read every row and then process it

e.g in pseudocode

READ FIRST ROW (car, house, tree)
DO UNTIL END OF SHEET
CALL PROCEDURE (passing the 3 column values as parameters)
READ ROW
LOOP


What I need is some sample code to replace the pseudocode.

Apologies for the beginner question, and any answer is much
appreciated.

cheers
Roshintosh


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
Beginner Question Bernie Charts and Charting in Excel 0 February 13th 07 04:31 PM
Beginner question! Pat Excel Discussion (Misc queries) 3 August 7th 06 09:19 AM
Beginner question Tom. Excel Discussion (Misc queries) 1 April 24th 06 06:08 AM
Beginner VBA question light Excel Programming 0 November 10th 04 05:40 PM
Beginner VBA question light Excel Programming 1 November 10th 04 01:44 PM


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