Runtime error 438

K

kima

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\Oversigtsskemaer 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
 
A

Auric__

kima said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top