Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ML ML is offline
external usenet poster
 
Posts: 57
Default Row Insert Function


Does anyone happen to have a row insert function?

If Row is inserted = True

Thank you

Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Row Insert Function

Please can you supply a bit more information:
Looking at the spread sheet, how would one know that a row had been insterted?
Or do you have occasions when the macro command to insert a row does not work?

"ML" wrote:


Does anyone happen to have a row insert function?

If Row is inserted = True

Thank you

Mark

  #3   Report Post  
Posted to microsoft.public.excel.programming
ML ML is offline
external usenet poster
 
Posts: 57
Default Row Insert Function

Hi Gleam

I am not sure precisely how I am going to approach the code yet.
If I had a Boolean function that is true when a row is inserted, I can
possibly work it out from there.

I am trying to figure out how to change some code dynamically based on if a
row is inserted

Mark



"Gleam" wrote:

Please can you supply a bit more information:
Looking at the spread sheet, how would one know that a row had been insterted?
Or do you have occasions when the macro command to insert a row does not work?

"ML" wrote:


Does anyone happen to have a row insert function?

If Row is inserted = True

Thank you

Mark

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Row Insert Function

even if the code were based on a worksheet_change, the worksheet
wouldn't necessarily know WHAT had changed. the only way i can see to
do this (non-guru person here) would be to have a counter somewhere on
a hidden sheet or in a hidden column that kept track of how many rows
you were working with and could thereby track whether or not that
number had changed.......
and even then you'd have to have the original number stored also so it
could compare them. unless it's a constant sized spreadsheet that is
supposed to never get any larger & you're looking for whether or not a
user has slipped an extra row in there.
just ideas
:)
susan



On Nov 28, 12:07 pm, ML wrote:
Hi Gleam

I am not sure precisely how I am going to approach the code yet.
If I had a Boolean function that is true when a row is inserted, I can
possibly work it out from there.

I am trying to figure out how to change some code dynamically based on if a
row is inserted

Mark



"Gleam" wrote:
Please can you supply a bit more information:
Looking at the spread sheet, how would one know that a row had been insterted?
Or do you have occasions when the macro command to insert a row does not work?


"ML" wrote:


Does anyone happen to have a row insert function?


If Row is inserted = True


Thank you


Mark- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
ML ML is offline
external usenet poster
 
Posts: 57
Default Row Insert Function

Hi Susan
I am primarily an AutoCAD-VBA programmer, however I dablle with Excel on
occasion, so please excuse me if I am not a guru either :)

OK, let me think of this in pseudo code:

We actually have a counter; it is The number of used rows in a given range.
So, this part does not seem that difficult pseudo wise.
If user inserts a row within this range; it is rowinsert + 1

The way I see it is, if The formulas can adjust dynaically in worksheet
based on an insert event, then macros would be able to also.
This would likely require a loop an an array of some sort.

Mark

"Susan" wrote:

even if the code were based on a worksheet_change, the worksheet
wouldn't necessarily know WHAT had changed. the only way i can see to
do this (non-guru person here) would be to have a counter somewhere on
a hidden sheet or in a hidden column that kept track of how many rows
you were working with and could thereby track whether or not that
number had changed.......
and even then you'd have to have the original number stored also so it
could compare them. unless it's a constant sized spreadsheet that is
supposed to never get any larger & you're looking for whether or not a
user has slipped an extra row in there.
just ideas
:)
susan



On Nov 28, 12:07 pm, ML wrote:
Hi Gleam

I am not sure precisely how I am going to approach the code yet.
If I had a Boolean function that is true when a row is inserted, I can
possibly work it out from there.

I am trying to figure out how to change some code dynamically based on if a
row is inserted

Mark



"Gleam" wrote:
Please can you supply a bit more information:
Looking at the spread sheet, how would one know that a row had been insterted?
Or do you have occasions when the macro command to insert a row does not work?


"ML" wrote:


Does anyone happen to have a row insert function?


If Row is inserted = True


Thank you


Mark- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Row Insert Function

There are three ways that I know to count rows. The one I would probably use is
Nrows=activecell.specialcells(xlLastcell).row
This is similar to doing control end on a spread sheet.

Number 2 is
Nrows=activesheet.usedrange.rows.count
This will give the same answer if there are no blank rows at the start. If
rows 1 and 2 are blank then it will give an answer 2 less than the first
method.

Number 3 is
Nrows = range("B47").currentregion.rows.count
This will give the number of rows in the continuous region around cell B47

To dynamically link to changes on the worksheet you need a macro on the
sheet. In the VBA editor please double click on the sheet and try this code:

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.UsedRange ' This line is needed to get correct answer when
rows
' are deleted.
MsgBox "No of used rows =" & ActiveCell.SpecialCells(xlLastCell).Row
End Sub

This works for inserting rows.
It doesn't work if the user deletes rows, unless the user also saves the
file! (in Excel 2003)

"ML" wrote:

Hi Susan
I am primarily an AutoCAD-VBA programmer, however I dablle with Excel on
occasion, so please excuse me if I am not a guru either :)

OK, let me think of this in pseudo code:

We actually have a counter; it is The number of used rows in a given range.
So, this part does not seem that difficult pseudo wise.
If user inserts a row within this range; it is rowinsert + 1

The way I see it is, if The formulas can adjust dynaically in worksheet
based on an insert event, then macros would be able to also.
This would likely require a loop an an array of some sort.

Mark

"Susan" wrote:

even if the code were based on a worksheet_change, the worksheet
wouldn't necessarily know WHAT had changed. the only way i can see to
do this (non-guru person here) would be to have a counter somewhere on
a hidden sheet or in a hidden column that kept track of how many rows
you were working with and could thereby track whether or not that
number had changed.......
and even then you'd have to have the original number stored also so it
could compare them. unless it's a constant sized spreadsheet that is
supposed to never get any larger & you're looking for whether or not a
user has slipped an extra row in there.
just ideas
:)
susan



On Nov 28, 12:07 pm, ML wrote:
Hi Gleam

I am not sure precisely how I am going to approach the code yet.
If I had a Boolean function that is true when a row is inserted, I can
possibly work it out from there.

I am trying to figure out how to change some code dynamically based on if a
row is inserted

Mark



"Gleam" wrote:
Please can you supply a bit more information:
Looking at the spread sheet, how would one know that a row had been insterted?
Or do you have occasions when the macro command to insert a row does not work?

"ML" wrote:

Does anyone happen to have a row insert function?

If Row is inserted = True

Thank you

Mark- Hide quoted text -

- Show quoted text -



  #7   Report Post  
Posted to microsoft.public.excel.programming
ML ML is offline
external usenet poster
 
Posts: 57
Default Row Insert Function

Hi Gleam
I agree with you on all levels; as I said before, I am primarily an
AutoCAD-VBA programmer and I dablle with Excel programming; although I do
like it a lot :)

I read everything you wrote, now let me go try your code, then get back

Thank you!

Mark

"Gleam" wrote:

Please can you supply a bit more information:
Looking at the spread sheet, how would one know that a row had been insterted?
Or do you have occasions when the macro command to insert a row does not work?

"ML" wrote:


Does anyone happen to have a row insert function?

If Row is inserted = True

Thank you

Mark

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert function Kevin Excel Discussion (Misc queries) 1 December 3rd 09 04:53 PM
customise Insert Function/Function Arguments dialog box Niek Otten Excel Programming 1 December 14th 06 11:27 AM
where/how to insert a function Khoshravan Excel Discussion (Misc queries) 6 July 29th 06 12:46 AM
Insert function Christina L. Excel Programming 0 May 9th 06 09:44 PM
Insert function - custom function name preceded by module name [email protected] Excel Programming 1 April 2nd 06 03:46 PM


All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"