Hi,
I've just registered with the site and this is my first post, I have various forums and posts as helpful resources in the past so thank you all for that!
I have some VB code which basically takes values from an input list and pastes them into a calculation sheets, where the results are copied and pasted as values on another sheet, this is repeated until all the values in the input list have been used. The code is taking a while to run so I want to speed it up by getting rid of the copy and paste, and use '.Value' instead which I've seen suggested on other posts, but I can't get it to work with mine.
Here is the relevant part of the code:
Note: 'PasteRowIndex'=1
For Each r In Range("B2", Range("B" & Rows.Count).End(xlUp))
Sheets("Single Account").Range("B1").Value = r.Value
Sheets("Single Account").Select
Rows("1:49").Select
Selection.Copy
Sheets("Results").Select
Rows(pasteRowIndex).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
pasteRowIndex = pasteRowIndex + 49
Sheets("Lookups").Select
Thanks for any help!
I've just registered with the site and this is my first post, I have various forums and posts as helpful resources in the past so thank you all for that!
I have some VB code which basically takes values from an input list and pastes them into a calculation sheets, where the results are copied and pasted as values on another sheet, this is repeated until all the values in the input list have been used. The code is taking a while to run so I want to speed it up by getting rid of the copy and paste, and use '.Value' instead which I've seen suggested on other posts, but I can't get it to work with mine.
Here is the relevant part of the code:
Note: 'PasteRowIndex'=1
For Each r In Range("B2", Range("B" & Rows.Count).End(xlUp))
Sheets("Single Account").Range("B1").Value = r.Value
Sheets("Single Account").Select
Rows("1:49").Select
Selection.Copy
Sheets("Results").Select
Rows(pasteRowIndex).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
pasteRowIndex = pasteRowIndex + 49
Sheets("Lookups").Select
Thanks for any help!