'You will need to change the cell reference From I2 to the cell which contains Age.
'Ageing Formula
=IF(I2>180,"Over 180 Days",IF(I2>120,"121 - 180 Days",IF(I2>90,"91 - 120 Days",IF(I2>60,"61 - 90 Days",IF(I2>30,"31 - 60 Days",IF(I2>15,"16 - 30 Days",IF(I2>10,"11 - 15 Days",IF(I2>5,"6 - 10 Days","Under 5 Days"))))))))
Wednesday, May 14, 2008
Thursday, January 17, 2008
Find Last Row with Data
' Paste this code where ever you want to find Last Row with data in Excel
Dim I as Long
Columns("A:A").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate
I = ActiveCell.ro
Dim I as Long
Columns("A:A").Select
Selection.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate
I = ActiveCell.ro
Find Last Cell (Row and Column) With Data in Excel- Full Proff
'Find Last Cell with data
'Use this Global Variables in Module
Dim LastRowWithData As Double
Dim LastColWithData As Double
'-----Call below Function from any part of the code and pass Worksheet object as parameter for which you want to find last cell--------
'----use Global varaibles to get Last Row with data and Last Column with data
'Function
Public Sub LastCellsWithData(Xls As Worksheet)
Xls.Activate
Dim ExcelLastCell As Object
Dim row As IntegerDim col As Integer
'SpecailCells is Inbuoild Function
Set ExcelLastCell = ActiveSheet.Cells.SpecialCells(xlLastCell)
' Determine the last row with data in it
LastRowWithData = ExcelLastCell.rowrow = ExcelLastCell.row
Do While Application.CountA(ActiveSheet.Rows(row)) = 0 And row <> 1
row = row - 1
Loop
LastRowWithData = row
' Determine the last column with data
LastColWithData = ExcelLastCell.Column
col = ExcelLastCell.Column
Do While Application.CountA(ActiveSheet.Columns(col)) = 0 And col <> 1
col = col - 1
Loop
LastColWithData = col
' Column number
End Sub
'Use this Global Variables in Module
Dim LastRowWithData As Double
Dim LastColWithData As Double
'-----Call below Function from any part of the code and pass Worksheet object as parameter for which you want to find last cell--------
'----use Global varaibles to get Last Row with data and Last Column with data
'Function
Public Sub LastCellsWithData(Xls As Worksheet)
Xls.Activate
Dim ExcelLastCell As Object
Dim row As IntegerDim col As Integer
'SpecailCells is Inbuoild Function
Set ExcelLastCell = ActiveSheet.Cells.SpecialCells(xlLastCell)
' Determine the last row with data in it
LastRowWithData = ExcelLastCell.rowrow = ExcelLastCell.row
Do While Application.CountA(ActiveSheet.Rows(row)) = 0 And row <> 1
row = row - 1
Loop
LastRowWithData = row
' Determine the last column with data
LastColWithData = ExcelLastCell.Column
col = ExcelLastCell.Column
Do While Application.CountA(ActiveSheet.Columns(col)) = 0 And col <> 1
col = col - 1
Loop
LastColWithData = col
' Column number
End Sub
Subscribe to:
Posts (Atom)