I'm making excels to calculate offers. We have a different kind of "packages" where you have different products. I'm trying to make a button which adds numbers in front of every product we need to offer "full package"
I'm updating these products in every month and adding rows so its really big work to update all "ranges". If I add one row its all gone because everything is +1.
Can I dim somehow these products like...
Dim Product1 range (J91)
Product1.value = 1
and it adds to number 1 to range witch I dim earlier.
In the future when I need to update I just change from one place all the ranges.
I have like 7 product packages so it is frustrating
Sub Package1_3P_4G()
Application.ScreenUpdating = False
Sheets("Gears").Select
Range("J74:J200").ClearContents
Range("J89").Value = 1 ' Add 1 pc Product1
Range("J90").Value = 1 ' Add 1 pc Product2
Range("J93").Value = 1 ' Add 1 pc Product3
Range("J123").Value = 2 ' Add 2 pc Product4
Range("J124").Value = 1 ' Add 1 pc Product5
Range("J134").Value = 1 ' Add 1 pcProduct6
End Sub
Do you mean something like that
Sub Test()
Dim e
For Each e In Array("J89", "J90", "J93", "J123", "J124", "J134")
Sheets("Gears").Range(e) = 1
Next e
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.