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

I am writing a macro in which I search a worksheet for a cell containing a
text string. I have managed to find the cell but then I want to performe
operations on all cells below that contains information. The problem is that
I cannot loop since I only manage to get the address in this form: $A$5 (or
other form that I do not know how to loop). I am wondering 1) do I have to
change the format of the cell address so that it is loopable (in the sense
that you can add a number to it). If so how? If not how do I solve the
problem? 2)How do I find the end of the list i.e. the first cell that
contains no information? I am very thankful for any assistance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Cell address

Assuming that you have a range object of the found cell, you can get the row
and column of that object and use those in a loop

Set oCell = Find(...

For i = oCell.Row + 1 To 100
'etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"anderssweden" wrote in message
...
I am writing a macro in which I search a worksheet for a cell containing a
text string. I have managed to find the cell but then I want to performe
operations on all cells below that contains information. The problem is

that
I cannot loop since I only manage to get the address in this form: $A$5

(or
other form that I do not know how to loop). I am wondering 1) do I have to
change the format of the cell address so that it is loopable (in the sense
that you can add a number to it). If so how? If not how do I solve the
problem? 2)How do I find the end of the list i.e. the first cell that
contains no information? I am very thankful for any assistance.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cell address

Thank you very much for your fast reply. Unfortunately I am novice VB user
and I do not know how to get the range of the obejct. My code so far is:

Private Sub findValue2()
Dim rng As Range
Dim findVal As String
Set rng = Worksheets("Dimension").Cells.Find("qc", LookIn:=xlValues)

With this part of the code I find the cell. I do not know how to get the
range which I then can use for the loop. Would be very thankful (again) for
fast assistance!
banker


"Bob Phillips" skrev:

Assuming that you have a range object of the found cell, you can get the row
and column of that object and use those in a loop

Set oCell = Find(...

For i = oCell.Row + 1 To 100
'etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"anderssweden" wrote in message
...
I am writing a macro in which I search a worksheet for a cell containing a
text string. I have managed to find the cell but then I want to performe
operations on all cells below that contains information. The problem is

that
I cannot loop since I only manage to get the address in this form: $A$5

(or
other form that I do not know how to loop). I am wondering 1) do I have to
change the format of the cell address so that it is loopable (in the sense
that you can add a number to it). If so how? If not how do I solve the
problem? 2)How do I find the end of the list i.e. the first cell that
contains no information? I am very thankful for any assistance.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Cell address

Sorry for disturbing but I think I found the answer:

Private Sub findValue2()
Dim rng As Range
Dim findVal As String
Set rng = Worksheets("Dimension").Cells.Find("qc", LookIn:=xlValues)
Worksheets("Indata").Range("K1") = rng
Worksheets("Indata").Range("K2") = rng.Row
Worksheets("Indata").Range("K3") = rng.Column
--
banker


"Bob Phillips" skrev:

Assuming that you have a range object of the found cell, you can get the row
and column of that object and use those in a loop

Set oCell = Find(...

For i = oCell.Row + 1 To 100
'etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"anderssweden" wrote in message
...
I am writing a macro in which I search a worksheet for a cell containing a
text string. I have managed to find the cell but then I want to performe
operations on all cells below that contains information. The problem is

that
I cannot loop since I only manage to get the address in this form: $A$5

(or
other form that I do not know how to loop). I am wondering 1) do I have to
change the format of the cell address so that it is loopable (in the sense
that you can add a number to it). If so how? If not how do I solve the
problem? 2)How do I find the end of the list i.e. the first cell that
contains no information? I am very thankful for any assistance.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Cell address

You are already doing it. rng is getting the range <g

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"anderssweden" wrote in message
...
Thank you very much for your fast reply. Unfortunately I am novice VB user
and I do not know how to get the range of the obejct. My code so far is:

Private Sub findValue2()
Dim rng As Range
Dim findVal As String
Set rng = Worksheets("Dimension").Cells.Find("qc", LookIn:=xlValues)

With this part of the code I find the cell. I do not know how to get the
range which I then can use for the loop. Would be very thankful (again)

for
fast assistance!
banker


"Bob Phillips" skrev:

Assuming that you have a range object of the found cell, you can get the

row
and column of that object and use those in a loop

Set oCell = Find(...

For i = oCell.Row + 1 To 100
'etc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"anderssweden" wrote in message
...
I am writing a macro in which I search a worksheet for a cell

containing a
text string. I have managed to find the cell but then I want to

performe
operations on all cells below that contains information. The problem

is
that
I cannot loop since I only manage to get the address in this form:

$A$5
(or
other form that I do not know how to loop). I am wondering 1) do I

have to
change the format of the cell address so that it is loopable (in the

sense
that you can add a number to it). If so how? If not how do I solve the
problem? 2)How do I find the end of the list i.e. the first cell that
contains no information? I am very thankful for any assistance.






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
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),QuoteNotes, sarah Excel Worksheet Functions 2 February 17th 09 02:59 PM
=HYPERLINK("#"&CELL("address", ADDRESS(MATCH(VALUE(B3),Range ... ? sarah Excel Worksheet Functions 0 February 17th 09 02:06 PM
Return cell address of a cell based on contents of cell. Danny Excel Worksheet Functions 4 November 15th 08 03:11 AM
find last cell in range with data, display cell address sevi61 Excel Worksheet Functions 14 October 29th 07 08:36 PM
How to create table of cell names with the name's cell address WildwoodEngr Excel Discussion (Misc queries) 1 October 26th 06 02:52 PM


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