Posting here as it is also a matter of speed.
I’m trying to copy-paste the back/lay odds etc in every refresh and store them horizontally. So somehow to use the transpose but I’m having some problems, VBA needs improvement.
Lets say I want to copy F5:F15 and H5:H15 and P5:P15 (amount matched) and paste them at lets say A100:AO100, AA100:AO100, BA100:BO100, next refresh paste at A101:AO101, AA101:AO101, BA101:BO101 etc.
The usual way of lets say:
For x = 1 To 11
Cells(99 + x, x) = Range("F" & x + 4).Value
Cells(99 + x, x + 26) = Range("H" & x + 4).Value
Cells(99 + x, x + 52) = Range("P" & x + 4).Value
Next x
Copies the required cells one by one and is very slow. We need a way to copy paste the hole array (F5:F15 etc) at once. The transpose is the way and the best way (quicker) so far I found is something like this:
Sheets("BF1-W").Range("F5:F15").Copy
Sheets("Temp1").Cells(LRow, x + 6).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
The problem with this is while recording the odds excel “flashes” as changes from one sheet (source) to another (destination).
Screenupdating = false doesn’t seem to help. Even if I copy – paste in the same sheet the “focus” changes from lets say A1 (where I want it to be) to the last cell that has just been copied to, lets say cell BO102.Far to away.
Any ideas or other way of quick transpose copy-paste?
Another one:
What is the best way to record the info if I want to group the info like this:
Cells F5,H5 and P5 per contender to be recorded at cells A100,B100,C100, info for next contender at D100,E100,F100 etc and at the next refresh to be recorded at cells A101,B101,C101, info for next contender at D101,E101,F101 etc.
An array for every selection with (F5,H5,P5) needs to be created and then copied ?
Any ideas?
Speed is one issue.