If the 1st two numbers are already populated and the numbers are in sequence then you don't need a formula or code... Simply highlight the first two cell and use the auto fill feature...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
That will not ignore the zero and will replace it with next sequence number .. I need all zero to be untouched and the next number after zero to continue off the above the zero cell ...if it's not clear , let me know to explain it differently.
The button inside the sheet is not clickable..i tried to d-click it but it shows code view..is there any shortcut or something?..I have excel 2007 btw.
1. In cell A2, enter: 1
2. In cell A3, enter: =MAX(A$2:A2)+1
3. Copy the formula down to, let say, cell A50
4. Now you have a sequence from 1 to 49
5. Enter 0 to wherever you want to overwrite a formula and you will see the values auto updated.
Don't forget to use [CODE]your code here[/CODE] when posting code
If your question was answered please use Thread Tools to mark your thread [RESOLVED]
1. In cell A2, enter: 1
2. In cell A3, enter: =MAX(A$2:A2)+1
3. Copy the formula down to, let say, cell A50
4. Now you have a sequence from 1 to 49
5. Enter 0 to wherever you want to overwrite a formula and you will see the values auto updated.
I think this one is working except it's duplicating numbers twice like [11,11,12,12..etc] ..I don't know what's wrong although i did exactly like above..any way to get rid of dublicates !!!
I don't know if i did it right but it's not working..i did like this :
selected the first top two cells and dragged little button right corner all the way to the bottom ..is this the correct way ??
The formula is already there....all you need to do is fill the first column and if it goes down then select the last cell in the 2nd column and drag the formula down...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
1.can't i just copy the formula and apply it on the autonumber that i have without creating extra column?
2.If i have two consecutive zeros , the code breaks so any solution?
For that you have to tweak the formula that I gave you but it will become more complex... I suggest using Anhn's way... BTW what problems were you facing with it? It is working perfectly for me?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
I think this one is working except it's duplicating numbers twice like [11,11,12,12..etc] ..I don't know what's wrong although i did exactly like above..any way to get rid of dublicates !!!
You did it wrong way!
After enter the formula in cell A3, you should copy only that single cell (A3) down instead of copy both cells (A2:A3).
For that you have to tweak the formula that I gave you but it will become more complex... I suggest using Anhn's way... BTW what problems were you facing with it? It is working perfectly for me?
Try to put at least 2 consecutive zeros then you will see it doesn't work !
When you say the first cell is A1, I assume A1 contains a number, not the column header "ID".
1. In A2, enter: =1+MAX(A$1:A1)
2. Copy cell A2
3. Paste (formula) to all non-0 cells
The formulas will auto adjust to such as in A3: =1+MAX(A$1:A2)
$ is used for absolute row. In this case $1 (row 1) will be kept unchange.
Don't forget to use [CODE]your code here[/CODE] when posting code
If your question was answered please use Thread Tools to mark your thread [RESOLVED]
This is a simplest function, it can be linked to a button.
Code:
Function FillNonZeroSeq()
Dim n As Long, r As Long
With Selection '-- select a range then run this function to fill
n = Val(.Cells(1))
For r = 2 To .Rows.Count
If .Cells(r, 1) <> "0" Then
n = n + 1
.Cells(r, 1) = n
End If
Next
End With
End Function
Don't forget to use [CODE]your code here[/CODE] when posting code
If your question was answered please use Thread Tools to mark your thread [RESOLVED]