I have a formula within a loop.
For x = 0 To dataLastColumn - 1
wsModel.Cells(startCell + 3, 2 + x).Formula = "=(($B$34*B33)/B30)*B31"
Next x
For each x I'd like to change the column for the next one. For example: if x = 1 than my desired formula would be -
wsModel.Cells(startCell + 3, 2 + 1).Formula = "=(($B$34*C33)/C30)*C31"
if x = 2
wsModel.Cells(startCell + 3, 2 + 2).Formula = "=(($B$34*D33)/D30)*D31"
Is there a way to change columns like that?
I Try This One Its Working
sModel.Cells(startCell + 3, 2 + x).Resize(, dataLastColumn-1).Formula = "=(($B$34*B33)/B30)*B31"
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.