Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I know how to get the last cell in a column:
range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try...
Range("IV1").End(xlToLeft).Column I prefer to use... With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With "Ayo" wrote: I know how to get the last cell in a column: range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Sheeloo. One more question, how do I use it in a for statement that
is looping through cells D14: T14 i.e., For Each c In Wsht.Range((4, 14), (4, lastColumn)).Cells If c.Value = Range("B4") Then getMSaddress = c.Address(ColumnAbsolute:=False) Exit Function End If Next c "Sheeloo" wrote: Try... Range("IV1").End(xlToLeft).Column I prefer to use... With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With "Ayo" wrote: I know how to get the last cell in a column: range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
dim c as range
Dim myRng as range with wsht set myrng = .range(.cells(4,14), .cells(4,lastcol)) end with for each c in myrng.cells ..... Ayo wrote: Thanks Sheeloo. One more question, how do I use it in a for statement that is looping through cells D14: T14 i.e., For Each c In Wsht.Range((4, 14), (4, lastColumn)).Cells If c.Value = Range("B4") Then getMSaddress = c.Address(ColumnAbsolute:=False) Exit Function End If Next c "Sheeloo" wrote: Try... Range("IV1").End(xlToLeft).Column I prefer to use... With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With "Ayo" wrote: I know how to get the last cell in a column: range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Dave.
"Dave Peterson" wrote: dim c as range Dim myRng as range with wsht set myrng = .range(.cells(4,14), .cells(4,lastcol)) end with for each c in myrng.cells ..... Ayo wrote: Thanks Sheeloo. One more question, how do I use it in a for statement that is looping through cells D14: T14 i.e., For Each c In Wsht.Range((4, 14), (4, lastColumn)).Cells If c.Value = Range("B4") Then getMSaddress = c.Address(ColumnAbsolute:=False) Exit Function End If Next c "Sheeloo" wrote: Try... Range("IV1").End(xlToLeft).Column I prefer to use... With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With "Ayo" wrote: I know how to get the last cell in a column: range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try
Wsht.Range(Cells(14, 4), Cells(14, lastColumn)).Select For Each c In Selection If c.Value = Range("B4") Then getMSaddress = c.Address Exit For End If Next c "Ayo" wrote: Thanks Sheeloo. One more question, how do I use it in a for statement that is looping through cells D14: T14 i.e., For Each c In Wsht.Range((4, 14), (4, lastColumn)).Cells If c.Value = Range("B4") Then getMSaddress = c.Address(ColumnAbsolute:=False) Exit Function End If Next c "Sheeloo" wrote: Try... Range("IV1").End(xlToLeft).Column I prefer to use... With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With "Ayo" wrote: I know how to get the last cell in a column: range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This could cause trouble.
If you're going to qualify .range, it's a good idea to qualify cells: Wsht.Range(wsht.Cells(14, 4), wsht.Cells(14, lastColumn)).Select And if wsht isn't the activesheet, then the .Select will fail. I wouldn't select the range to work on it. Sheeloo wrote: Try Wsht.Range(Cells(14, 4), Cells(14, lastColumn)).Select For Each c In Selection If c.Value = Range("B4") Then getMSaddress = c.Address Exit For End If Next c "Ayo" wrote: Thanks Sheeloo. One more question, how do I use it in a for statement that is looping through cells D14: T14 i.e., For Each c In Wsht.Range((4, 14), (4, lastColumn)).Cells If c.Value = Range("B4") Then getMSaddress = c.Address(ColumnAbsolute:=False) Exit Function End If Next c "Sheeloo" wrote: Try... Range("IV1").End(xlToLeft).Column I prefer to use... With ActiveSheet lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column End With "Ayo" wrote: I know how to get the last cell in a column: range("A65536").End(xlUp).address for the row number range("A65536").End(xlUp).row for the row number but I am not sure how to translate this to doing the same for the row. Any help with be appreciated. Thanks. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Determine if column contains duplicate value | Excel Discussion (Misc queries) | |||
How to determine the column letter from Cell address | Excel Worksheet Functions | |||
How can I determine the largest physical size cell in a column | Excel Worksheet Functions | |||
Determine which column to use by date | Excel Worksheet Functions | |||
Determine if Value in column A exists in Column B | Excel Discussion (Misc queries) |