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
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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")
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,218,737
Messages
6,144,204
Members
450,529
Latest member
Mumbaekeshi

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
Back
Top