Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Row number for End of Template

I have a data gathering template used in our department and the length of the
template could vary. Regardless of the length though, the row at the end of
the template will have the word TOTAL in column C of that row.

The USer can still add text into rows below the one identified as the end of
the template i.e. if cell C69 has the word, Total, then row 69 will be
assumed to be the ned of the template regardless of how many non-empty rows
are after that.

I tried to write a code to identify the end of the template(see below) but
it is not working. The Do Loop wasn't exited. ANy help will be appreciated.

Pele


Worksheets(2).Activate
s = 0
Do
s = s + 1
Cells(s, 3).Select
z = Cells(s, 3)
If z = "total" Then
Exit Do
End If
Loop
Size = z

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Row number for End of Template

Hi Pele,

You could use the Find method to do this:

Dim rng As Range

Set rng = Columns(3).Find(What:="total")
If Not rng Is Nothing Then MsgBox rng.Row

Set rng = Nothing

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]

Pele wrote:
I have a data gathering template used in our department and the
length of the template could vary. Regardless of the length though,
the row at the end of the template will have the word TOTAL in column
C of that row.

The USer can still add text into rows below the one identified as the
end of the template i.e. if cell C69 has the word, Total, then row 69
will be assumed to be the ned of the template regardless of how many
non-empty rows are after that.

I tried to write a code to identify the end of the template(see
below) but it is not working. The Do Loop wasn't exited. ANy help
will be appreciated.

Pele


Worksheets(2).Activate
s = 0
Do
s = s + 1
Cells(s, 3).Select
z = Cells(s, 3)
If z = "total" Then
Exit Do
End If
Loop
Size = z



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
Automatically use next number on a template Nenagh Excel Discussion (Misc queries) 1 June 11th 09 08:12 AM
Template Wizard - Number of fields Randy Cole Excel Discussion (Misc queries) 0 June 8th 06 09:20 PM
How do i number a template so that it will increase 1,2,3 etc? Dreamworks New Users to Excel 1 July 28th 05 11:43 AM
How do I set up a template to assign a unique number? Feltonblue Excel Programming 3 October 5th 04 06:55 PM
How do I set up an Excel template to generate a new number every . Tom Ogilvy Excel Programming 0 September 15th 04 05:24 PM


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