Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Traversing the collumn of the active cell

Hi:
I need to traverse the collums of the active cell looking for data, can I
use:
ActiveCell.Collumn.cells in a foreeach loop?
Any help apreciated.
Sean.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Traversing the collumn of the active cell



LastCol = cellls(activecell.row,columns.count).end(xltoleft) .column
For ColCount = 1 to Lastcol
Data = .cells(Activecell.row,ColCount)
if Data = "ABC" then
'enter your code here
end if
next ColCount

"Sean Farrow" wrote:

Hi:
I need to traverse the collums of the active cell looking for data, can I
use:
ActiveCell.Collumn.cells in a foreeach loop?
Any help apreciated.
Sean.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Traversing the collumn of the active cell

Hi

Try this:

For Each cell In Columns(ActiveCell.Column).Cells
a = a + 1
Next
Debug.Print a

Regards,
Per

"Sean Farrow" skrev i meddelelsen
...
Hi:
I need to traverse the collums of the active cell looking for data, can I
use:
ActiveCell.Collumn.cells in a foreeach loop?
Any help apreciated.
Sean.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Traversing the collumn of the active cell

Hi:
What does the line:
LastCol = cellls(activecell.row,columns.count).end(xltoleft) .column
Achieve?
Cheers
Sean.
"Joel" wrote in message
...


LastCol = cellls(activecell.row,columns.count).end(xltoleft) .column
For ColCount = 1 to Lastcol
Data = .cells(Activecell.row,ColCount)
if Data = "ABC" then
'enter your code here
end if
next ColCount

"Sean Farrow" wrote:

Hi:
I need to traverse the collums of the active cell looking for data, can I
use:
ActiveCell.Collumn.cells in a foreeach loop?
Any help apreciated.
Sean.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Traversing the collumn of the active cell

There should only be two ll (not 3). The line gets the last cell with data
in the column. cells.count is a constant in excel that represents the last
column on the worksheet like in excel 2003 which is column 256.
end(xltoleft) move from column 256 to the left until a cell with data is
found.

You didn't specify how many columns you needed to transverse.

"Sean Farrow" wrote:

Hi:
What does the line:
LastCol = cellls(activecell.row,columns.count).end(xltoleft) .column
Achieve?
Cheers
Sean.
"Joel" wrote in message
...


LastCol = cellls(activecell.row,columns.count).end(xltoleft) .column
For ColCount = 1 to Lastcol
Data = .cells(Activecell.row,ColCount)
if Data = "ABC" then
'enter your code here
end if
next ColCount

"Sean Farrow" wrote:

Hi:
I need to traverse the collums of the active cell looking for data, can I
use:
ActiveCell.Collumn.cells in a foreeach loop?
Any help apreciated.
Sean.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Traversing the collumn of the active cell

Chers Both, I'#ve solved this.
Sean.
"Per Jessen" wrote in message
...
Hi

Try this:

For Each cell In Columns(ActiveCell.Column).Cells
a = a + 1
Next
Debug.Print a

Regards,
Per

"Sean Farrow" skrev i meddelelsen
...
Hi:
I need to traverse the collums of the active cell looking for data, can I
use:
ActiveCell.Collumn.cells in a foreeach loop?
Any help apreciated.
Sean.




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
counting if data from one collumn is present in another collumn Amelia Excel Worksheet Functions 1 February 8th 07 10:05 PM
replace the letters (for collumn) & numbers(row no.) of cell reference only al007 Excel Programming 0 November 14th 05 04:45 PM
Delete all of collumn after cell... Zlord[_4_] Excel Programming 2 October 29th 05 12:31 AM
traversing across columns in VBA Peter Bailey[_2_] Excel Programming 4 October 19th 04 06:59 AM
Traversing Rows Tom Ogilvy Excel Programming 0 August 20th 03 05:10 PM


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

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"