geversud,
You could add the incrementation value to a blank cell. Copy it, then on the values you want to increment just do a paste special, change the operation to add, and press OK. This will increment all values in the paste range by the orginal copied value.
Basically, I have a worksheet full of parts. In one column is the level of assembly and in the other the partnumber. (level of assembly reads as number 1 for the top most part with all the subcomponents of the assembly as level 2 and and sub components of 2 parts as level 3 and so on) There are many of these worksheets and the column representing the level of assembly is offset by 1 (for example the second part reads as level 1 but should be level 2) this is for all the parts. So in short, what would be the most efficient way to increment this column by 1.
This works well but I would like to avoid having to assign a value to a cell then copy it and paste it. I have to execute this operation hundreds of times and would like not to disrupt the integrity of the sheets beyond incrementing those values in column. Is there another way I can accomplish this strictly in the background through code?
Sub Increment()
Dim OldValue as String
OldValue = Range("A1").value
Range("A1").value = 1
Range("A1").copy
Range("b1",range("B65535").end(xlup)).pastespecial xlPasteValues,xlPasteSpecialOperationAdd
Range("A1").value =OldValue
End Sub
This will increment all values in column B by 1, each time it is executed.
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.