Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last column
how can i find the last column in a particular row.
To fidn the last column in a the sheet we find thru: With ActiveSheet.UsedRange lastColSum = .Column + .Columns.Count - 1 End With but what if i want to find in a particular row? thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last column
Sub FindLastEmptyCellInRow1()
Dim rng As Range 'find the last cell in row 1 with something in it. Set rng = Rows(1).Cells.Find("*", , , xlPart, xlByColumns, xlPrevious, False) If rng Is Nothing Then 'no occupied cells MsgBox "Column: #1" Else If rng.Column = Columns.count Then MsgBox "Last cell is full" Else MsgBox "Column: #" & rng.Column + 1 End If End If Set rng = Nothing End Sub wrote in message ... how can i find the last column in a particular row. To fidn the last column in a the sheet we find thru: With ActiveSheet.UsedRange lastColSum = .Column + .Columns.Count - 1 End With but what if i want to find in a particular row? thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last column
thanks a lot bob..for a very quick response and a
wonderful solution thanks again! -----Original Message----- Sub FindLastEmptyCellInRow1() Dim rng As Range 'find the last cell in row 1 with something in it. Set rng = Rows(1).Cells.Find("*", , , xlPart, xlByColumns, xlPrevious, False) If rng Is Nothing Then 'no occupied cells MsgBox "Column: #1" Else If rng.Column = Columns.count Then MsgBox "Last cell is full" Else MsgBox "Column: #" & rng.Column + 1 End If End If Set rng = Nothing End Sub wrote in message ... how can i find the last column in a particular row. To fidn the last column in a the sheet we find thru: With ActiveSheet.UsedRange lastColSum = .Column + .Columns.Count - 1 End With but what if i want to find in a particular row? thanks in advance . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
find last column
Also try
LastCol = Cells(1, Columns.Count).End(xlToLeft).Colum -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FInd common data in one column then add number in adjacent column | Excel Worksheet Functions | |||
find last row value in column when using MATCH to find column | Excel Worksheet Functions | |||
Find something in column a then find if column B matches criteria | Excel Discussion (Misc queries) | |||
Find First Non blank cell than find column header and return that value | Excel Worksheet Functions | |||
How to find the most recent date in a column based on other column | Excel Worksheet Functions |