View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Go to what I just typed

You could use worksheet_change to fire the worksheet_calculate. But maybe even
simpler would be to put a helper formula in a cell:

=counta(a:a)

As soon as you type something in Column A, this formula will recalculate and
then your worksheet_calculate event will fire.

You could even put it at the top of the worksheet (row 1) to keep track of how
many rows of data you have

or a variation:
=counta(a:a)-2
(if you had two header rows)

ps. don't put the formula in column A -- or limit the range:
=counta(a2:A65536)



David wrote:

I stumbled onto the Worksheet_Calculate() method of sorting and find it
very useful in one of my workbooks.

Private Sub Worksheet_Calculate()
Dim Lrow As Long
On Error GoTo ws_exit:
Application.EnableEvents = False
Lrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A17:H" & Lrow).Sort key1:=Range("A17"), header:=xlNo
Range("I17:I" & Lrow).FillDown 'insure Formula gets added where needed
ws_exit:
Application.EnableEvents = True
End Sub

Routinely I will insert a row at the bottom of existing data for new data
and then type in a name

I would like to add something to the routine so when I type in that name,
it not only immediately gets put in the proper row alphabetically, but the
routine would then jump to that row. I can't figure it out.

--
David


--

Dave Peterson