Copying solved values to a new worksheet

KevinZ

New Member
Joined
Apr 14, 2019
Messages
33
I am maximizing a value ($L$4) by changing the values in ($A$2:$A$134), value changed from 0 to 1 and limiting to only 6 records being chosen. I want to copy a specific cell (Column C) for each of these and place it in a row in the new spreadsheet. Output would look like this
[TABLE="width: 384"]
<colgroup><col width="64" style="width:48pt" span="6"></colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent, align: right"][/TD]
[TD="width: 64, bgcolor: transparent, align: right"][/TD]
[TD="width: 64, bgcolor: transparent, align: right"][/TD]
[TD="width: 64, bgcolor: transparent, align: right"][/TD]
[TD="width: 64, bgcolor: transparent, align: right"][/TD]
[TD="width: 64, bgcolor: transparent, align: right"][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 384"]
<colgroup><col width="64" style="width:48pt" span="6"> </colgroup><tbody>[TR]
[TD="width: 64, bgcolor: transparent, align: right"]12472009[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]12472010[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]12472011[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]12472012[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]12472013[/TD]
[TD="width: 64, bgcolor: transparent, align: right"]12472014[/TD]
[/TR]
</tbody>[/TABLE]

My current code copies all 134 values and places them in a column.


Dim List_Current_row As Long

List_Current_row = Worksheets("Export").Cells(Rows.Count, 1).End(xlUp).Row + 1

If i = 0 Then
Worksheets("Export").Cells(List_Current_row, 1).Resize(1, 6).Value = _Worksheets("Parameters").Range("C2:C201").Value
Else
Worksheets("Export").Cells(List_Current_row, 1).Resize(200, 1).Value = _ Worksheets("Parameters").Range("C2:C201").Value
End If



Any ideas on what I am doing wrong? Any help is appreciated.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I wish I can see data on your Sheet. I see your code wrong at Resize 6 column, but [C2:C201] is row not column. You need use formula Transpose to change Row-Column. With code:
x.Resize(1,6) = WorksheetFunction.Transpose(Worksheets("Parameters").Range("C2:C201"))

If you need
detail it, you would use { For i = [C2].row to [C201].row } to do that.
 
Upvote 0
I am maximizing the value from Column F with constraints on column D. When solved for 6 values, the 0 in column A is changed from 0 to 1 for the 6 records. I want to take the corresponding number from Column C and place them on a new spreadsheet as referenced above.

I changed the code as suggested but I am getting a Runtime error 438 message on the new line.

Let me know if there is anything else you need to see.

[TABLE="width: 535"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Column A[/TD]
[TD][/TD]
[TD]Column C[/TD]
[TD]Column D[/TD]
[TD][/TD]
[TD]Column F[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472001[/TD]
[TD="align: right"]11600[/TD]
[TD][/TD]
[TD="align: right"]227[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472002[/TD]
[TD="align: right"]11300[/TD]
[TD][/TD]
[TD="align: right"]152[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472003[/TD]
[TD="align: right"]10900[/TD]
[TD][/TD]
[TD="align: right"]243[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472004[/TD]
[TD="align: right"]10400[/TD]
[TD][/TD]
[TD="align: right"]218[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472005[/TD]
[TD="align: right"]10000[/TD]
[TD][/TD]
[TD="align: right"]244[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472006[/TD]
[TD="align: right"]9700[/TD]
[TD][/TD]
[TD="align: right"]219[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472007[/TD]
[TD="align: right"]9500[/TD]
[TD][/TD]
[TD="align: right"]105[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472008[/TD]
[TD="align: right"]9400[/TD]
[TD][/TD]
[TD="align: right"]200[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD][/TD]
[TD="align: right"]12472009[/TD]
[TD="align: right"]9300[/TD]
[TD][/TD]
[TD="align: right"]220[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Forgetting macros a little, you could explain what data you have and what you expect as a result, explain with step-by-step examples what you want to maximize.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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