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

New to the world of Excel VBA programming.

I've used a macro so far to chop a large spreadsheet down to the minimum
info that I need to work with.

It has 13 rows and the number of columns can vary.

Row 1 is a header row (will always have a string value)
Row 2 is a Text ID row (will always have a string value)
Rows 3-13 Text Name row (can have a string value or be empty)

Basically need to parse through the spreadsheet and where the cells in rows
3-13 are not blank do some work. Basically create two lines out to a text
file for each non-emtpy cell.

A B C D etc
1 H1 H2 H3 H4
2 111 222 333 444
3 qrs nji
4 rsd esd
5 fgh asd sew
....
13 ewe erw

For this example set I would get the following to a text file:

TextID1=H1
TextName1=qrs
TextID2=H1
TextName2=fgh
TextID3=H2
TextName3=rsd
TextID4=H2
TextName4=asd
TextID5=H3
TextName5=sew
TextID6=H3
TextName6=ewe
TextID7=H4
TextName7=nji
TextID8=H4
TextName8=esd
TextID9=H4
TextName9=erw

Doing this in C, Pascal or even Fortran would be fairly straight forward but
the Excel VBA cell references and calls is totally unfamiliar. I'm starting
to read up on this to understand how it is handled.

Any help anyone would be willing to give or pointers to some examples that
would lead me in the right direction would be greatly appreciated.

Thanks,
Kirk


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Stepping through cells

Hi Kirk

Assuming that you deal with the active sheet, and that the looping is the
problem, not the text generating:

Sub test()
Dim R As Long, C As Long
C = 1
Do
For R = 3 To 13
If Cells(R, C).Value < "" Then
MsgBox "Yo! " & Cells(1, C).Value
MsgBox Cells(R, C).Value
End If
Next
C = C + 1
Loop Until Cells(1, C).Value = ""
End Sub

As you may see, Cells is the magic word, addressed like
Cells(Rownumber, Columnnumber)

HTH. Best wishes Harald

"Kirk" skrev i melding
...
New to the world of Excel VBA programming.

I've used a macro so far to chop a large spreadsheet down to the minimum
info that I need to work with.

It has 13 rows and the number of columns can vary.

Row 1 is a header row (will always have a string value)
Row 2 is a Text ID row (will always have a string value)
Rows 3-13 Text Name row (can have a string value or be empty)

Basically need to parse through the spreadsheet and where the cells in

rows
3-13 are not blank do some work. Basically create two lines out to a text
file for each non-emtpy cell.

A B C D etc
1 H1 H2 H3 H4
2 111 222 333 444
3 qrs nji
4 rsd esd
5 fgh asd sew
...
13 ewe erw

For this example set I would get the following to a text file:

TextID1=H1
TextName1=qrs
TextID2=H1
TextName2=fgh
TextID3=H2
TextName3=rsd
TextID4=H2
TextName4=asd
TextID5=H3
TextName5=sew
TextID6=H3
TextName6=ewe
TextID7=H4
TextName7=nji
TextID8=H4
TextName8=esd
TextID9=H4
TextName9=erw

Doing this in C, Pascal or even Fortran would be fairly straight forward

but
the Excel VBA cell references and calls is totally unfamiliar. I'm

starting
to read up on this to understand how it is handled.

Any help anyone would be willing to give or pointers to some examples that
would lead me in the right direction would be greatly appreciated.

Thanks,
Kirk




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
Stepping through Code Jim May Excel Discussion (Misc queries) 9 October 25th 07 01:40 PM
stepping chart Petje Charts and Charting in Excel 2 July 7th 06 10:22 PM
Stepping Through vs. Play CWillis Excel Discussion (Misc queries) 1 June 15th 06 05:34 PM
Stepping through For Each...Next backwards? Mike Lee[_2_] Excel Programming 5 June 6th 04 07:42 PM
Stepping through a column using FOR/NEXT Joe Mathis Excel Programming 1 December 3rd 03 06:36 AM


All times are GMT +1. The time now is 12:54 AM.

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"