marlonsaveri
Board Regular
- Joined
- Jan 28, 2011
- Messages
- 68
Hi, I tried so many times, but it's wrong:
In this case, WhatToSearch is in merged cell, but there's so many cells filled in front that.
Code:
Function FindLastCol(i As Integer) As Long
Dim busca As Range
Dim WhatToSearch As String
WhatToSearch = "Espessura"
Set busca = Sheets(i).Cells.Find(what:=WhatToSearch, after:=Range("A1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If Not busca Is Nothing Then
FindLastCol = Cells(busca.Row, Columns.Count).End(xlToLeft).Column
End If
End Function
In this case, WhatToSearch is in merged cell, but there's so many cells filled in front that.