Troubleshoot compile error. Overflow:

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Hi,

Please help.
Getting compile error.
Compile error
Overflow:
'm running this from sheet2 button.

Thanks
Pedie;)

Code:
Sub try()
Const x As Integer = 1
Const y As Integer = 65500
Const c As Integer = 12
Dim chk As Integer
With Sheets("Sheet1")
For chk = x To y
If .Cells(chk, c).Value = "X" Then
.Cells(chk, c).Value = "Y"
.Cells(chk, c).Offset(0, -10).Resize(, 11).Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next chk
End With
End Sub
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Thanks for the advice.
I have just changed to
x = 1
y = 65500
c = 12
which works ok now.
Can i please ask 1 more queston?
i know i just did lol!
k, can i make
Code:
Private Sub Workbook_Open()
code not run if I'm updating this workbook using other book?
 
Upvote 0
Yep

Application.EnableEvents=False
'
'open book
'
Application.enableevents=true
 
Upvote 0
Thanks again guys!
Thanks Peter, it works perfect!

Brian, thanks!
 
Upvote 0

Forum statistics

Threads
1,214,567
Messages
6,120,268
Members
448,953
Latest member
Dutchie_1

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