ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection of Range Class Failed?? (https://www.excelbanter.com/excel-programming/346845-selection-range-class-failed.html)

TimT

Selection of Range Class Failed??
 
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?

Norman Jones

Selection of Range Class Failed??
 
Hi TimT,

Range("A1:J100").Select <--- HANGS UP HERE!!


Try:

Sheets("K1_Info").Range("A1:J100").Select

---
Regards,
Norman



"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?




Arvi Laanemets

Selection of Range Class Failed??
 
Hi

....
Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets(K1_Info").Range("A1:J100").Copy
Sheets("G-2").Range("A11").PasteSpecial Paste:=xlPasteValues,
Operation:=xlNone, SkipBlanks :=False, Transpose:=False
....

Arvi Laanemets



"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?




Don Guillett[_4_]

Selection of Range Class Failed??
 
Try
Sub CopyWkBookToWkBook()
Set SWB = Workbooks.Open("sourceworkwb.xls")
Set DWB = Workbooks("destinationwb.XLS")
SWB.Sheets("CHECKS").Range("a8:b15").Copy _
DWB.Sheets("SHEET9").Range("a1")
SWB.Close SaveChanges:=False
End Sub

--
Don Guillett
SalesAid Software

"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?




Don Guillett[_4_]

Selection of Range Class Failed??
 
You said values SO (notice same size ranges)

Sub CopyWkBookToWkBookValues()
Set SWB = Workbooks.Open("sourcewb.xls")
Set DWB = Workbooks("destinationwb.XLS")
DWB.Sheets("SHEET9").Range("a8:b15").Value = _
SWB.Sheets("CHECKS").Range("a8:b15").Value
SWB.Close SaveChanges:=False
End Sub

--
Don Guillett
SalesAid Software

"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?




TimT

Selection of Range Class Failed??
 
that worked!

I have another question if you could help...

Another part of the code call for the sheet to be saved as a .dif file.
before the code ends it asks for confirmation that would require a yes to the
dialog box. is there a way to answer yes automatically?

"Norman Jones" wrote:

Hi TimT,

Range("A1:J100").Select <--- HANGS UP HERE!!


Try:

Sheets("K1_Info").Range("A1:J100").Select

---
Regards,
Norman



"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?





Norman Jones

Selection of Range Class Failed??
 
Hi Tim.

Try something like:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="YourFileName.dif", _
FileFormat:=xlDIF, CreateBackup:=False
Application.DisplayAlerts = True

---
Regards,
Norman



"TimT" wrote in message
...
that worked!

I have another question if you could help...

Another part of the code call for the sheet to be saved as a .dif file.
before the code ends it asks for confirmation that would require a yes to
the
dialog box. is there a way to answer yes automatically?

"Norman Jones" wrote:

Hi TimT,

Range("A1:J100").Select <--- HANGS UP HERE!!


Try:

Sheets("K1_Info").Range("A1:J100").Select

---
Regards,
Norman



"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?







TimT

Selection of Range Class Failed??
 
Yeah I just realized that.....
Thank you so much brah!

"Norman Jones" wrote:

Hi Tim.

Try something like:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="YourFileName.dif", _
FileFormat:=xlDIF, CreateBackup:=False
Application.DisplayAlerts = True

---
Regards,
Norman



"TimT" wrote in message
...
that worked!

I have another question if you could help...

Another part of the code call for the sheet to be saved as a .dif file.
before the code ends it asks for confirmation that would require a yes to
the
dialog box. is there a way to answer yes automatically?

"Norman Jones" wrote:

Hi TimT,

Range("A1:J100").Select <--- HANGS UP HERE!!

Try:

Sheets("K1_Info").Range("A1:J100").Select

---
Regards,
Norman



"TimT" wrote in message
...
Hello all...
this works in a macro but not in code..


Workbooks.Open Filename:="C:\1040WP\K1_Info.xls"
Sheets("K1_Info").Select
Range("A1:J100").Select <--- HANGS UP HERE!!
Selection.Copy
Windows("Electronic Workpapers-Final V 1.1.6.xls").Activate
Sheets("G-2").Select
Range("A11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("A11").Select


Can someone tell me what I'm doing wrong?








All times are GMT +1. The time now is 07:22 PM.

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