ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Runtime error 438 (https://www.excelbanter.com/excel-programming/447815-runtime-error-438-a.html)

kima

(SOLVED) Runtime error 438
 
HOW DO I DELETE A POST??? -------

Cant get it to work...please help!!

Kim :)

Have made a comment where the debugger makes the error box.

Sub CopyOpenItems()

Dim wbTarget As Workbook 'workbook where the data is to be pasted
Dim wbThis As Workbook 'workbook from where the data is to copied
Dim strName As String 'name of the source sheet/ target workbook

saveFolder = "L:\INST\AFD 260 Automation\KM\Bane_dk_dataopsamling\Oversigtsskema er målinger\"

'set to the current active workbook (the source book)
Set wbThis = ActiveWorkbook

'get the active sheetname of the book
strName = ActiveSheet.Name

'open a workbook that has same name as the sheet name
Set wbTarget = Workbooks.Open(saveFolder & "procent.xlsx")

'select cell A1 on the target book
wbTarget.Range("C2").Select (---MAKING A RUNTIME ERROR 438---)

'clear existing values form target book
wbTarget.Range("C2").ClearContents

'activate the source book
wbThis.Activate

'clear any thing on clipboard to maximize available memory
Application.CutCopyMode = False

'copy the range from source book
wbThis.Range("G1").Copy

'paste the data on the target book
wbTarget.Range("C2").PasteSpecial

'clear any thing on clipboard to maximize available memory
Application.CutCopyMode = False

'save the target book
wbTarget.Save

'close the workbook
wbTarget.Close

'activate the source book again
wbThis.Activate

'clear memory
Set wbTarget = Nothing
Set wbThis = Nothing

End Sub

Auric__

Runtime error 438
 
kima wrote:

HOW DO I DELETE A POST???


You can't. This is Usenet; Excelbanter is essentially just a Usenet<-WWW
interface. Your post is archived *forever*. ;-) Enjoy.

--
Microsoft gave you Windows -- OS/2 gave you the whole house.

kima

Thx....nice to know


All times are GMT +1. The time now is 03:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com