Joshua0317
New Member
- Joined
- Feb 23, 2011
- Messages
- 4
Hello. I am trying to speed up macros that were written by people before me. I have basically just removing the Copy/Paste code and using
Sheets(destination).Range(putithere)=Sheets(source).Range(data).value
This works fine for data assignments within a single workbook, but when it comes to getting items from a data workbook and putting the information into a report workbook, the procedure doesn't work. A sample of the original code is below:
I would like to get rid of the 'Activates' and 'Copy' procedures. Something like this:
Sheets(destination).Range(putithere)=Sheets(source).Range(data).value
This works fine for data assignments within a single workbook, but when it comes to getting items from a data workbook and putting the information into a report workbook, the procedure doesn't work. A sample of the original code is below:
Code:
Sub Open_Indics()
'
'
'
Dim h, i, j As Variant
h = Range("filename")
i = Range("IndicationWKBK")
j = Range("IndicationsWKBK2")
Workbooks.Open Filename:=i, UpdateLinks:=False, ReadOnly:=True
Windows(h).Activate
Range("Stateno").Copy
Windows(j).Activate
Sheets("States").Select
Range("O1").PasteSpecial xlPasteValues, xlPasteSpecialOperationNone, SkipBlanks:=False, Transpose:=False
End Sub
I would like to get rid of the 'Activates' and 'Copy' procedures. Something like this:
Code:
Sub Open_Indics()
'
'
'
Dim h, i, j As Variant
h = Range("filename")
i = Range("IndicationWKBK")
j = Range("IndicationsWKBK2")
Workbooks.Open Filename:=i, UpdateLinks:=False, ReadOnly:=True
Windows(j).Sheets("States").Range("O1") = Windows(h).Range("Stateno").Value
End Sub