![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
This it a part from an old macro I wrote a while back.
Now trying to get a cell function from it. ' Function to provide # of last line of table as it is edited (row # needed for % is table) '---------------------------------------- ' ------ Clen (column length -finds last row) ------ Public Function CLen() As Integer Range("A500").Select ' below max table length Selection.End(xlUp).Select CLen = ActiveCell.Row ' **?? number displayed is row last edited !!! End Function ' ----------------------------- Now the function runs when row is deleted does not run when row is inserted How can I set this up so: 1) it runs when table changes size (can be by several ways usually insert text copy, row insert, delete row) 2) Get correct line number (where function is placed at end of col A) |
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
Public Function CLen() As Integer Application.Volatile CLen = Range("A65536").End(xlUp).Row ' **?? number displayed is row last edited !!! End Function I don't think you can build something in the function to address question 2 (but I'm bound to be wrong, someone else on the board will provide an answer and I'll learn something new. That's the beauty of this board Regards,
__________________
Barrie Davidson "You're only given a little spark of madness. You mustn't lose it." - Robin Williams |
|
|
|
|
|
|
#3 |
|
Guest
Posts: n/a
|
THANKS, its a start... Its been awhile since I have done much VB programming in Excel, but its as fun as I remember. haha
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|