Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default apply next number in newly inserted row

I have a CommandButton that Inserts a row in a particular location. I would
now like to continue the macro to search col B for the highest number and
then apply the next number to cell of col B in row just inserted. Note - the
numbers in col B are not always in order on the list.

Thanks for any help given
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default apply next number in newly inserted row

The key is that once you have inserted a row, the activecell will be in that
row:

Sub put_it()
ActiveCell.EntireRow.Insert
Set b = Range("B:B")
Cells(ActiveCell.Row, "B").Value = Application.WorksheetFunction.Max(b) + 1
End Sub

--
Gary''s Student - gsnu200828


"KUMPFfrog" wrote:

I have a CommandButton that Inserts a row in a particular location. I would
now like to continue the macro to search col B for the highest number and
then apply the next number to cell of col B in row just inserted. Note - the
numbers in col B are not always in order on the list.

Thanks for any help given

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default apply next number in newly inserted row

Perfect! Thank you!

"Gary''s Student" wrote:

The key is that once you have inserted a row, the activecell will be in that
row:

Sub put_it()
ActiveCell.EntireRow.Insert
Set b = Range("B:B")
Cells(ActiveCell.Row, "B").Value = Application.WorksheetFunction.Max(b) + 1
End Sub

--
Gary''s Student - gsnu200828


"KUMPFfrog" wrote:

I have a CommandButton that Inserts a row in a particular location. I would
now like to continue the macro to search col B for the highest number and
then apply the next number to cell of col B in row just inserted. Note - the
numbers in col B are not always in order on the list.

Thanks for any help given

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
Need Help on populating a newly inserted row [email protected] Excel Programming 1 August 5th 08 02:34 PM
Carrying over formulas into newly inserted row Riphay Excel Discussion (Misc queries) 2 August 8th 07 03:02 AM
17 digit number not inserted hit44 Excel Discussion (Misc queries) 2 December 10th 06 07:48 AM
Automatically fill one cell in any newly inserted row spoko Excel Discussion (Misc queries) 1 November 11th 05 06:45 PM
Naming a newly inserted sheet using VBA Ant Excel Discussion (Misc queries) 2 October 5th 05 01:55 PM


All times are GMT +1. The time now is 03:43 PM.

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"