View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Boldie Boldie is offline
external usenet poster
 
Posts: 3
Default Activating a workbook

I have tried that but it still doesn't work. Have you any more ideas?

"NickHK" wrote:

What if you change it to Workbooks("Book1.xls").Activate ?
But it is seldom necessary to Activate/Select objects before you work with
them.
Dim i As Long

With Workbooks("Book1.xls")
Do
'Note the "." before Range now
If Not IsNumeric(.Range("A1").Offset(i,0).Text) Then
...etc
End If
i=i+1

NickHK

"Boldie" wrote in message
...
This is my code

Dim BookName As String
Dim RowNum As Integer
'
BookName = ActiveWorkbook.Name
Windows("Book1.xls").Activate **** This is where i get the

error.
Range("A1").Activate
Do
If Not IsNumeric(ActiveCell.Text) Then
ActiveCell.EntireRow.Delete
Else
ActiveCell.Offset(1, 0).Activate
End If
Loop Until ActiveCell.Value = "End"

ActiveCell.Value = ""
RowNum = ActiveCell.Row

Range("A1:A" & RowNum).Select
Selection.Copy
Windows(BookName).Activate

Range("C1").Activate
Do
ActiveCell.Offset(1, 0).Activate
Loop Until ActiveCell.Value = ""

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,

SkipBlanks _
:=False, Transpose:=True

Range("A1").Activate
End Sub


"NickHK" wrote:

You current code would help.
But I would guess it has something to do using ActiveWorkbbok/Sheet.

NickHK

"Boldie" wrote in message
...
I am using a PDF converter to get some data out of the pdf into an

excel
spreadsheet. The converter opens a new workbook (normally Book1.xls).

I
also have a workbook that contains my code to take the data out of the
newly
opened workbook into my current workbook. when i run the code i get a
run-time error 9 when trying to activate the newly open workbook.

This
does
not happen if i save the workbook and close it then reopen it.

can anyone help.