Rohdekill Posted June 16, 2015 Share Posted June 16, 2015 I need to repeat the following for 70+ rows: If ROW = 19 Then [AC19].Value = [AC19].Value + [F19].Value [F19].Value = 0 ElseIf ROW = 20 Then [AC20].Value = [AC20].Value + [F20].Value [F20].Value = 0 ElseIf ROW = 21 Then [AC21].Value = [AC21].Value + [F21].Value [F21].Value = 0 End If Is there a way to use ROW within the variable name itself so that I can use just one entry? Something like this... [AC{ROW}].Value = [AC{ROW}].Value + [F{ROW}].Value [F{ROW}].Value = 0 Link to comment Share on other sites More sharing options...
0 -Himanshu- Posted June 16, 2015 Share Posted June 16, 2015 Arrays should work in this case. Use row number as the index. Link to comment Share on other sites More sharing options...
0 mulligan2k Posted June 16, 2015 Share Posted June 16, 2015 you can use the indirect function for formula sums. that allows you to pull data from a cell and use it as part of a formula does your program perform this once or multiple times? Link to comment Share on other sites More sharing options...
0 Rohdekill Posted June 16, 2015 Author Share Posted June 16, 2015 There's a series of buttons flowing down the Excel sheet. The general idea is for someone to enter time against the task, click the button (on that row) and it adds the time to the total, then zero out what they entered. I'm grabbing the row # from one sub, then passing it to this sub. But, I sure don't want to have to code "if on row one, do this". All of the columns are consistent. I'll look into the Indirect. Thanks! Link to comment Share on other sites More sharing options...
0 Haggis Veteran Posted June 16, 2015 Veteran Share Posted June 16, 2015 can you send us the sheet Link to comment Share on other sites More sharing options...
Question
Rohdekill
I need to repeat the following for 70+ rows:
Is there a way to use ROW within the variable name itself so that I can use just one entry?
Something like this...
Link to comment
Share on other sites
4 answers to this question
Recommended Posts