View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Column number of last column that returns value ignore formulas

On Tuesday, May 27, 2014 12:35:13 PM UTC-7, Claus Busch wrote:
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:


Hi Claus,

That last used column in row 3 is always column W as that is as far to the right the formulas go. D to W are all formulas, some will have values returned some will not. This is a changing thing with other activity in the workbook.

If column H is the last cell to returns a value, that is the column number I want. Cells past H on over to W with no values showing are ignored.

I will then use that column number in a resize code to color fill the row from column A to that returned value in H. Next time it may column R is the last occurring value.

I'm looking for help because I can't make the code ignore a cell with a formula but showing NO value but recognize a cell with a value showing.

I'll test your code to make sure it does or does not do what I am looking for.

Thanks.
Howard