willywonka11
New Member
- Joined
- Nov 6, 2017
- Messages
- 2
I need to speed up my code. This code is looped through hundreds of times and is super slow. The problem is that the range of cells I need to copy and paste changes.
Here is my original code:
Worksheets(Sht2).Activate
Worksheets(Sht2).Range(Cells(13, 1), Cells(LastPt, 15)).Copy Worksheets(ShtName).Activate
Worksheets(ShtName).Range(Cells(13, 1), Cells(13, 1)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Here is the code that I can't get to work:
Worksheets(ShtName).Range(Cells(13, 1), Cells(LastPt, 15)).Value = Worksheets(Sht1).Range(Cells(13, 1), Cells(LastPt, 15)).Value
What is frustrating is that I have been able to get this code to work but I need to be able to change the number of rows being copied.:
Worksheets(ShtName).Range(Cells(1, 1), Cells(60, 15)).Value = Worksheets(Sht1).Range("A1:O60").Value
Here is my original code:
Worksheets(Sht2).Activate
Worksheets(Sht2).Range(Cells(13, 1), Cells(LastPt, 15)).Copy Worksheets(ShtName).Activate
Worksheets(ShtName).Range(Cells(13, 1), Cells(13, 1)).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Here is the code that I can't get to work:
Worksheets(ShtName).Range(Cells(13, 1), Cells(LastPt, 15)).Value = Worksheets(Sht1).Range(Cells(13, 1), Cells(LastPt, 15)).Value
What is frustrating is that I have been able to get this code to work but I need to be able to change the number of rows being copied.:
Worksheets(ShtName).Range(Cells(1, 1), Cells(60, 15)).Value = Worksheets(Sht1).Range("A1:O60").Value