ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I put a cell location (ie. row and column #, not value in. (https://www.excelbanter.com/excel-programming/327767-how-can-i-put-cell-location-ie-row-column-not-value.html)

KyWilde

How can I put a cell location (ie. row and column #, not value in.
 
I have a date value, 4/1/2005, that I would like to find the cell location of
and put into a variable. Is this possible? I would like to use this
location to calculate other necessary items dynamically as the dates pass.
All I really need, and definitely need, is the row the value is in. If you
have an idea on how to do this it would be most helpful and appreciated.
Thanks!

Jim Thomlinson[_3_]

How can I put a cell location (ie. row and column #, not value in.
 
Try this...

Sub FindDate()
Dim wks As Worksheet
Dim rngSearch As Range
Dim rngFound As Range

Set wks = ActiveSheet
Set rngSearch = wks.Cells
Set rngFound = rngSearch.Find("4/1/2005")

If rngFound Is Nothing Then
MsgBox "Sorry... Not Found"
Else
MsgBox rngFound.Address
End If
End Sub

HTH

"KyWilde" wrote:

I have a date value, 4/1/2005, that I would like to find the cell location of
and put into a variable. Is this possible? I would like to use this
location to calculate other necessary items dynamically as the dates pass.
All I really need, and definitely need, is the row the value is in. If you
have an idea on how to do this it would be most helpful and appreciated.
Thanks!


Stevie_mac

How can I put a cell location (ie. row and column #, not value in.
 
Not entirely certain what you mean, but I think you need the following functions...
Lookup, VLookup & HLookup.

As an example, put in Sheet2 the following entries (in A1 to B3)...
3/1/2005 third
4/1/2005 forth
5/1/2005 fifth

On sheet1, put =VLookup(A1, Sheet2!A1:C200,2,FALSE) in CELL A2
Now, type 4/1/2005 in Sheet1 A1 - this put the text "forth" in cell A2
Overtype A1 with 5/1/2005 - this will put "fifth" in cell A2

Hope this helps - Steve.


"KyWilde" wrote in message
...
I have a date value, 4/1/2005, that I would like to find the cell location of
and put into a variable. Is this possible? I would like to use this
location to calculate other necessary items dynamically as the dates pass.
All I really need, and definitely need, is the row the value is in. If you
have an idea on how to do this it would be most helpful and appreciated.
Thanks!




KyWilde

How can I put a cell location (ie. row and column #, not value
 
Thank you! This is exactly what I needed!

"Jim Thomlinson" wrote:

Try this...

Sub FindDate()
Dim wks As Worksheet
Dim rngSearch As Range
Dim rngFound As Range

Set wks = ActiveSheet
Set rngSearch = wks.Cells
Set rngFound = rngSearch.Find("4/1/2005")

If rngFound Is Nothing Then
MsgBox "Sorry... Not Found"
Else
MsgBox rngFound.Address
End If
End Sub

HTH

"KyWilde" wrote:

I have a date value, 4/1/2005, that I would like to find the cell location of
and put into a variable. Is this possible? I would like to use this
location to calculate other necessary items dynamically as the dates pass.
All I really need, and definitely need, is the row the value is in. If you
have an idea on how to do this it would be most helpful and appreciated.
Thanks!


KyWilde

How can I put a cell location (ie. row and column #, not value
 
Thanks Jim! That's exactly what I needed!

"Jim Thomlinson" wrote:

Try this...

Sub FindDate()
Dim wks As Worksheet
Dim rngSearch As Range
Dim rngFound As Range

Set wks = ActiveSheet
Set rngSearch = wks.Cells
Set rngFound = rngSearch.Find("4/1/2005")

If rngFound Is Nothing Then
MsgBox "Sorry... Not Found"
Else
MsgBox rngFound.Address
End If
End Sub

HTH

"KyWilde" wrote:

I have a date value, 4/1/2005, that I would like to find the cell location of
and put into a variable. Is this possible? I would like to use this
location to calculate other necessary items dynamically as the dates pass.
All I really need, and definitely need, is the row the value is in. If you
have an idea on how to do this it would be most helpful and appreciated.
Thanks!



All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com