Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Repeat: Active Cell's Address

Hello All
Your answers are right, but I think I could not put it right.
How to get the Activecell's address? Then how to use it in conjunction with
Range, Address etc.? Also how can I use the MsgBox to show it so that I know
the program flow is correct? Also, when I say
For each c in Worksheets("sheet1").Rows("5:5").Cells
if c.value = 50 then
....
what should I write in for c.range, c.address ? [I was wondering when
c.value works why not c.range or c.address?]
Thanks
Milind


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 170
Default Repeat: Active Cell's Address

c is not the ActiveCell. You would have to c.Activate c to be the
ActiveCell. Acivate is rarely necessary and ruins performance, so avoid it.

Address of ActiveCell = ActiveCell.Address
Address of c (within your loop) = c.Address
(why do you say c.address doesn't work? Keep in mind that Address returns
"$A$1", not "A1" if you are doing a string comparison)

HTH,
--
George Nicholson

Remove 'Junk' from return address.


"Milind" wrote in message
...
Hello All
Your answers are right, but I think I could not put it right.
How to get the Activecell's address? Then how to use it in conjunction
with Range, Address etc.? Also how can I use the MsgBox to show it so that
I know the program flow is correct? Also, when I say
For each c in Worksheets("sheet1").Rows("5:5").Cells
if c.value = 50 then
...
what should I write in for c.range, c.address ? [I was wondering when
c.value works why not c.range or c.address?]
Thanks
Milind



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Repeat: Active Cell's Address

You don't actually need the address and c is a range reference, so you don't
need c.range

Sub String_Find_and_Paste()
Dim s_text As String
Dim r As Range
Dim s As Range

For Each c In Worksheets("Sheet1").Rows("5:5").Cells
s_text = c.Value
If InStr(1, s_text, "India", vbTextCompare) 0 Then
'Get the activeCell's address, offset it & paste
cell.copy ActiveCell.Offset(10,0)
ActiveCell.Offset(10,0).Select
msgbox ActiveCell.Address
end if
Next
End Sub

--
Regards,
Tom Ogilvy

"Milind" wrote in message
...
Hello All
Your answers are right, but I think I could not put it right.
How to get the Activecell's address? Then how to use it in conjunction

with
Range, Address etc.? Also how can I use the MsgBox to show it so that I

know
the program flow is correct? Also, when I say
For each c in Worksheets("sheet1").Rows("5:5").Cells
if c.value = 50 then
...
what should I write in for c.range, c.address ? [I was wondering when
c.value works why not c.range or c.address?]
Thanks
Milind




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
Referencing an active cell's content from another sheet. emon Excel Worksheet Functions 2 November 12th 08 05:54 PM
Need to refer to a cell's address, not it's content... aduroche Excel Discussion (Misc queries) 3 October 18th 07 08:54 PM
cell's address of the largest number novio Excel Discussion (Misc queries) 1 April 9th 05 10:16 PM
How can I change a text to a cell's address? Antônio Sobral Excel Discussion (Misc queries) 0 February 15th 05 04:55 PM
How do I programmatically know the current cell's address Keith[_5_] Excel Programming 3 September 9th 03 08:00 PM


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