passing a string form a array to a cell value

Ricardo Caicedo

New Member
Joined
Aug 21, 2014
Messages
43
Hello Forum</SPAN>

I got a subscript 9 error for the declaration down here, (columns and NextRow is a Long), strVarNames is a range that I previously created (Dynamic array) and it basically could contains the column string name i.e. “Q” or “R” as I need to pass the column location in the spreadsheet to be fill with a value from the array x()</SPAN>

The part that is failing is :


For j = 3 To Columns</SPAN>
Cells(NextRow, strVarNames(j)).Value = x(j)</SPAN>
Next j</SPAN>

So for example if I got in the strVarNames(3)= "</SPAN>N"</SPAN> , NextRow = 51 then I need to allocate the value of x(1) to the cell (51,N)</SPAN>

Any suggestion, I already expend too much time try to solve this problem, but I got the same problem</SPAN>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Have you tried Range(strVarNames(j) & NextRow)? Cells requires numbers for row and column
 
Upvote 0

Forum statistics

Threads
1,223,204
Messages
6,170,729
Members
452,353
Latest member
strainu

We've detected that you are using an adblocker.

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.
Go back
Back
Top