Property or method not supported?

TimmiT

Board Regular
Joined
Dec 15, 2006
Messages
77
Well, I am having a heck of a time getting this macro to run right. This gets called several times, and I had had issues with the variable and cell references being qualified. I moved this to its own module, made it option explicit, and tried to dim all the variables, and qualify all the references.

Currently, the it is telling me "Object doesnt support this property or method.", and debugs to the copy line.
Code:
Option Explicit
Sub Lc()
Dim lastlog As Integer
Dim nums As Integer
Dim numss As Integer
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Set xlBook = ThisWorkbook
Set xlSheet = Sheets("List")
lastlog = UserForm1.ComboBox109.Value 'Log number

nums = 10 * (lastlog) + 10
numss = nums + 8
xlBook.xlSheet.Range("i" & nums, "j" & numss).Copy
xlBook.xlSheet.Range("i3").PasteSpecial xlPasteValues
'Sheets("List").Range(Sheets("List").Cells(nums, "i"), Sheets("List").Cells(numss, "j")).Copy
'Sheets("List").Cells(3, 9).PasteSpecial xlPasteValues

End Sub
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Try

xlBook.xlSheet.Range("i" & nums & ":j" & numss).Copy
 

TimmiT

Board Regular
Joined
Dec 15, 2006
Messages
77
Code:
xlBook.xlSheet.Range("i" & nums & ":j" & numss).Copy
Gives me the same error.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
Remove xlBook from here, it's not needed.
Code:
xlBook.xlSheet.Range("i" & nums, "j" & numss).Copy 
xlBook.xlSheet.Range("i3").PasteSpecial xlPasteValues
You might also want to change this:
Code:
Set xlBook = ThisWorkbook 
Set xlSheet = Sheets("List")
To this:
Code:
Set xlBook = ThisWorkbook 
Set xlSheet = xlBook.Sheets("List")
 

TimmiT

Board Regular
Joined
Dec 15, 2006
Messages
77
Thanks Norie. That seems to get things copied, but I get an error on the paste.

Code:
Option Explicit
Sub Lc()
Dim lastlog As Integer
Dim nums As Integer
Dim numss As Integer
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet

Set xlBook = ThisWorkbook
Set xlSheet = xlBook.Sheets("List")
lastlog = UserForm1.ComboBox109.Value 'Log number

nums = 10 * (lastlog) + 10
numss = nums + 8
xlSheet.Range("i" & nums & ":j" & numss).Copy
xlSheet.Range("i3").PasteSpecial xlPasteValues

End Sub

It tells me not enough memory, then says method 'pasetespecial' of object 'range' failed
 

Watch MrExcel Video

Forum statistics

Threads
1,122,469
Messages
5,596,321
Members
414,053
Latest member
Dual Showman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top