View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Column number of last column that returns value ignore formulas

Hi Howard,

Am Tue, 27 May 2014 12:07:06 -0700 (PDT) schrieb L. Howard:

Sub LastColumnInOneRow()
'Find the last used column in a Row: row 3 in this example (23)
Dim LastCol As Integer
With ActiveSheet
LastCol = .Cells(3, .Columns.Count).End(xlToLeft).Column
End With
MsgBox LastCol
End Sub


I don't know if I understand your problem.
Your macro finds the last used column in row 3.
If you want to find the last error in row 3 then try:

Sub LastColumnInOneRow()
Dim i As Long

With ActiveSheet
For i = 23 To 1 Step -1
If IsError(.Cells(3, i)) Then
MsgBox i
Exit For
End If
Next
End With

End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional