#1   Report Post  
Posted to microsoft.public.excel.misc
Wu Wu is offline
external usenet poster
 
Posts: 36
Default cells problem

I write a macro to find a pair of data at different cells in a worksheet.

After finding, I would like to get the x of the cells or Y of the
cells..........
for example, the found data at cells(2,2) and cells(3,4)
I want to write a macro to get the 2 and 3 ,
L1 = x of cells 1
L2 = x of cells 2

Can I use function to get the loacation of the cells ?
How to write in macro to get the x or y , or x and y of a cell?


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default cells problem

Here is an example with one cell andone value. Let's say we are looking for
"happiness":

Sub findit()
v = "happiness"
For Each r In ActiveSheet.UsedRange
If r.Value = v Then
x = r.Row
y = r.Column
MsgBox ("happiness can be found in cell(" & x & "," & y & ")")
End If
Next
End Sub
--
Gary''s Student - gsnu200786


"Wu" wrote:

I write a macro to find a pair of data at different cells in a worksheet.

After finding, I would like to get the x of the cells or Y of the
cells..........
for example, the found data at cells(2,2) and cells(3,4)
I want to write a macro to get the 2 and 3 ,
L1 = x of cells 1
L2 = x of cells 2

Can I use function to get the loacation of the cells ?
How to write in macro to get the x or y , or x and y of a cell?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 48
Default cells problem

....or
If r.Value = v Then
MsgBox r.Address
End If


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
Problem when navigating between cells Josh W Excel Discussion (Misc queries) 2 June 10th 07 03:01 PM
Problem with clicking on cells Gabriel B Excel Discussion (Misc queries) 2 January 11th 06 11:50 PM
Problem with Blank cells vgurusa Excel Discussion (Misc queries) 2 October 14th 05 09:56 PM
Help me! There is problem with cells view... :-) Excel Discussion (Misc queries) 1 April 28th 05 01:16 PM
problem with cells KLP Excel Discussion (Misc queries) 3 January 11th 05 06:01 PM


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