macro for auto ID

chakravar

New Member
Joined
Feb 25, 2004
Messages
15
Hi everyone:
I am a novice trying to write a macro for autonumber creation for the following format. Excel Gurus plz share your ideas in this thread. Thanks for your time.
chakravar

ID IP
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
1 128.119.169.245
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
2 128.172.1.115
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
128.172.115.93
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
129.63.184.5
131.128.197.79
131.128.197.79
131.128.197.79
131.128.197.79
131.128.197.79
131.128.197.79
131.128.197.79
131.128.197.79
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
Hi!
You may use colo's html maker below. its a free add in. you can down load that and have your sheet shown properly.
 
Upvote 0

chakravar

New Member
Joined
Feb 25, 2004
Messages
15
IPautoID.xls
ABCD
1IDIP
21128.119.169.245
31128.119.169.245
41128.119.169.245
51128.119.169.245
61128.119.169.245
71128.119.169.245
81128.119.169.245
91128.119.169.245
101128.119.169.245
111128.119.169.245
121128.119.169.245
131128.119.169.245
142128.172.1.115
152128.172.1.115
162128.172.1.115
172128.172.1.115
182128.172.1.115
192128.172.1.115
202128.172.1.115
212128.172.1.115
222128.172.1.115
232128.172.1.115
242128.172.1.115
25128.172.115.93
26128.172.115.93
27128.172.115.93
28128.172.115.93
29128.172.115.93
30128.172.115.93
Sheet1
 
Upvote 0

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
Hi,

Welcome to the board.

What makes 128.119.169.245 = 1 and 128.119.169.245= 2?
Is there a specific criteria to this?
Is it just that the ip changes from 128.119.169.245 to 128.119.169.245 and therefore should be the next number?

Regards
 
Upvote 0

SIXTH SENSE

Well-known Member
Joined
Oct 29, 2003
Messages
1,883
Hi!
Hi try this one!
I deleted my first post. Its a mess.
Book1
ABCD
1IdIp
21128.119.169.245
31128.119.169.245
41128.119.169.245
51128.119.169.245
61128.119.169.245
71128.119.169.245
81128.119.169.245
91128.119.169.245
101128.119.169.245
111128.119.169.245
121128.119.169.245
131128.119.169.245
142128.172.1.115
152128.172.1.115
162128.172.1.115
172128.172.1.115
182128.172.1.115
192128.172.1.115
202128.172.1.115
212128.172.1.115
222128.172.1.115
232128.172.1.115
242128.172.1.115
253128.172.115.93
263128.172.115.93
273128.172.115.93
283128.172.115.93
293128.172.115.93
303128.172.115.93
Sheet1


the code<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> Id()<SPAN style="color:#00007F">For</SPAN> I = 2<SPAN style="color:#00007F">To</SPAN> Range("b65536").End(xlUp).Row
    <SPAN style="color:#00007F">If</SPAN> Range("a" & I).Value = ""<SPAN style="color:#00007F">Then</SPAN>
    <SPAN style="color:#00007F">If</SPAN> Application.WorksheetFunction.CountIf(Range("b1:B" & I), Range("b" & I)) > 1<SPAN style="color:#00007F">Then</SPAN>
        tmp = Application.WorksheetFunction.Match(Range("b" & I).Value, Range("b1:B" & I - 1), 0)
        Range("a" & I).Value = Application.WorksheetFunction.Index(Range("a1:A" & I - 1), tmp)
    <SPAN style="color:#00007F">Else</SPAN>
        Range("a" & I).Value = Application.WorksheetFunction.Max(Range("a2:a" & I - 1)) + 1
    <SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN>
    <SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">If</SPAN><SPAN style="color:#00007F">Next</SPAN> I<SPAN style="color:#00007F">End</SPAN><SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0

Forum statistics

Threads
1,187,187
Messages
5,962,095
Members
438,583
Latest member
DJTCharts

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top