Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone, currently I am working on an excel project.

I have created a button with the macro named resetRow. Upon typing in a row number in the cell C10 and clicking the button, the column and user-defined row will have a formula inserted into the spreadsheet.

What I want to achieve is to be able to type multiple numbers in the input cell (C10) instead of just one number. For example if I type "15,16,18, 20-29" the rows 15, 16, 18 and rows 20 to 29 will have formulas inserted into their cells. Does anyone have any idea how I should go about doing that?

VB
Dim resetRow As Integer
resetRow = Range("C10").Value

Range("F" & (resetRow) & ":I" & (resetRow)).Formula = "=G10_Anchor+short_end_increment*(base_year-F$57)"
Range("K" & (resetRow) & ":L" & (resetRow)).Formula = "=G10_Anchor+short_end_increment*(base_year-F$57)"
Range("G10_anchor_range").Formula = "=G10_Anchor"
Range("CEE_anchor_range").Formula = "=CEE_Anchor"
Range("CEE_anchor_range").Formula = "=CM_Anchor"
End Sub
Posted
Updated 27-May-15 21:45pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900