PC Review


Reply
Thread Tools Rate Thread

autonumber plus

 
 
stan
Guest
Posts: n/a
 
      18th Aug 2009
I am keeping track of invoice revisions. .Each new worksheet is copied into
a new workbook. Worksheets are

grouped by worksheet number and renamed as by invoice number using the
following code.:

Public Sub RenameSheet()
NewName = Range("c7").Value & "-" & Range("h4").Value
ActiveSheet.Name = NewName
End Sub

Currently I have users enter a sequential value in h4. Range c7 contains
the invoice number, which must remain the same.

I would like to automate this part. So that it first looks to c7, copies
it, then addes a sequential number in h4, avoiding duplication and starting
with 1.

any help would be most appreciated

--
stan
 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      18th Aug 2009
Humm, you may find a use for this:

Sub InsertMissingNum()

Range("A2").Select
Do Until ActiveCell.Value = Empty
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1 Then
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.EntireRow.Insert
ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
ActiveCell.Offset(1, 0).Select
End If
Loop

End Sub

It increments by 1, and inserts rows so your existing data stays the same,
relative to your new data.

So, let's say you have 1, 2, 3...8...10, all in Column A. Run the macro.
Does it do what you want?

HTH,
Ryan---


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"stan" wrote:

> I am keeping track of invoice revisions. .Each new worksheet is copied into
> a new workbook. Worksheets are
>
> grouped by worksheet number and renamed as by invoice number using the
> following code.:
>
> Public Sub RenameSheet()
> NewName = Range("c7").Value & "-" & Range("h4").Value
> ActiveSheet.Name = NewName
> End Sub
>
> Currently I have users enter a sequential value in h4. Range c7 contains
> the invoice number, which must remain the same.
>
> I would like to automate this part. So that it first looks to c7, copies
> it, then addes a sequential number in h4, avoiding duplication and starting
> with 1.
>
> any help would be most appreciated
>
> --
> stan

 
Reply With Quote
 
stan
Guest
Posts: n/a
 
      18th Aug 2009
it solved the problem. thanks
--
stan


"ryguy7272" wrote:

> Humm, you may find a use for this:
>
> Sub InsertMissingNum()
>
> Range("A2").Select
> Do Until ActiveCell.Value = Empty
> If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1 Then
> ActiveCell.Offset(1, 0).Select
> Else
> ActiveCell.EntireRow.Insert
> ActiveCell.Value = ActiveCell.Offset(-1, 0).Value + 1
> ActiveCell.Offset(1, 0).Select
> End If
> Loop
>
> End Sub
>
> It increments by 1, and inserts rows so your existing data stays the same,
> relative to your new data.
>
> So, let's say you have 1, 2, 3...8...10, all in Column A. Run the macro.
> Does it do what you want?
>
> HTH,
> Ryan---
>
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "stan" wrote:
>
> > I am keeping track of invoice revisions. .Each new worksheet is copied into
> > a new workbook. Worksheets are
> >
> > grouped by worksheet number and renamed as by invoice number using the
> > following code.:
> >
> > Public Sub RenameSheet()
> > NewName = Range("c7").Value & "-" & Range("h4").Value
> > ActiveSheet.Name = NewName
> > End Sub
> >
> > Currently I have users enter a sequential value in h4. Range c7 contains
> > the invoice number, which must remain the same.
> >
> > I would like to automate this part. So that it first looks to c7, copies
> > it, then addes a sequential number in h4, avoiding duplication and starting
> > with 1.
> >
> > any help would be most appreciated
> >
> > --
> > stan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autonumber without a autonumber field PennyB Microsoft Access VBA Modules 3 3rd Jul 2009 05:41 PM
Create a Sub Autonumber that re-assigns autonumber to each data groupin a sorted field. Junwenren Microsoft Access 1 4th Oct 2008 05:30 AM
Adding autonumber to a non autonumber field don Microsoft Access 2 22nd Apr 2008 05:00 PM
code to autonumber form ID without using autonumber datatype reservedbcreater Microsoft Access Form Coding 4 27th Jan 2005 03:56 PM
AutoNumber field does not contain "(AutoNumber)" when adding a record Keith Microsoft Access Forms 3 12th Nov 2003 04:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:50 PM.