Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default initials + increment

Hi,
Question from new macro writer but a non-programmer.

How can you increment in column A a reference number in the following
format?

ABC-0001
ABC-0002
ABC-0003
[...]
ABC-1000

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default initials + increment

Hi Puba,

Try:

'=============
Public Sub Tester()
Dim SH As Worksheet
Dim rng As Range

Set SH = ThisWorkbook.Sheets("Sheet1") '<<==== CHANGE
Set rng = SH.Range("A1:A100") '<<==== CHANGE

rng(1).Value = "ABC-0001"
rng(2).Value = "ABC-0002"
rng.Resize(2).AutoFill Destination:=Range("A1:A100"), _
Type:=xlFillDefault

End Sub
'<<=============


---
Regards,
Norman



wrote in message
oups.com...
Hi,
Question from new macro writer but a non-programmer.

How can you increment in column A a reference number in the following
format?

ABC-0001
ABC-0002
ABC-0003
[...]
ABC-1000

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default initials + increment

Hi Puba,

Change:

rng.Resize(2).AutoFill Destination:=Range("A1:A100"), _
Type:=xlFillDefault


to

rng.Resize(2).AutoFill Destination:=rng, _
Type:=xlFillDefault


---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default initials + increment

The best way of doing this is using the "&" symbol when you refrence
two cells...Please try to follow the instructions below and see if this
works, as it has for me in the past.

Column A (Row 1): =B1&C1&D1
Column B (Row 1): ABC
Column C (Row 1): -000
Column D (Row 1): 1
-------------------------------------------------
Column A (Row 2): =$B$1&$C$1&D1
Column B (Row 2): <----------------- EMPTY CELL
Column C (Row 2): <----------------- EMPTY CELL
Column D (Row 2): =SUM(D1+1)
--------------------------------------------------

You will realize how simple the process is and how functional the "&"
is, after you get the hang of how the formula works. If you need to
hide Column B, C, or D then do so however, you might find that you will
need to probally fill down to the bottom of the sheet with the formula
in Column A and D if you are trying to create some sorta of database.
Hope this helps...probally amature to some but simple to follow.

-Shaka215


====================
wrote:
Hi,
Question from new macro writer but a non-programmer.

How can you increment in column A a reference number in the following
format?

ABC-0001
ABC-0002
ABC-0003
[...]
ABC-1000

Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default initials + increment

i think this is what you mean: -

'=== code starts
Sub test()
Dim x
For x = 1 To 1000
ActiveCell.Value = "ABC-" & Format(x, "0000")
ActiveCell.Offset(1, 0).Select
Next x
End Sub
'=== code ends

hth,

tim


wrote in message
oups.com...
Hi,
Question from new macro writer but a non-programmer.

How can you increment in column A a reference number in the following
format?

ABC-0001
ABC-0002
ABC-0003
[...]
ABC-1000

Thanks





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default initials + increment

Thank you all three of you.
I'll try that now and will post back next week some feedback.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default initials + increment

I tend to use methods that don't require so much VBA coding but more
analitical thinking...You might find my method is more gear towards
Excel versus VBA macro script.


wrote:
Thank you all three of you.
I'll try that now and will post back next week some feedback.


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
Changing initials into numbers Kathie Excel Worksheet Functions 2 February 3rd 10 06:09 PM
Need Period After Initials Susan Excel Worksheet Functions 21 May 15th 07 09:45 PM
Create initials from Full name Charlotte Howard Excel Discussion (Misc queries) 3 March 21st 07 03:51 PM
Increment/Increment letter in alphabetical order Neil Goldwasser Excel Programming 3 January 25th 06 09:07 AM
Returning User Initials Kelly[_3_] Excel Programming 10 August 11th 03 07:07 PM


All times are GMT +1. The time now is 02:52 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"