ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I REQUIRE SOME HELP WITH CODE (https://www.excelbanter.com/excel-programming/377222-i-require-some-help-code.html)

tracks via OfficeKB.com

I REQUIRE SOME HELP WITH CODE
 
The following is the code i need some help with

SUB co()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Set rng1 = Worksheets("DATE").Range("B4")
Set rng2 = Worksheets("summ").Range("A6:.cells(rows.count,3). End
(xlUp)")
Set rng3 = Worksheets("summ").Range("A6:.CELLS(ROWS.COUNT,5). End
(xlUp)")
X = 0
Y = 0

If Month(rng1) Month(rng2) Then
Range("rng3").Copy _
Worksheets("sheet3").Range("A6:E31").Offset(X, Y)

X = X + 7
Y = Y - 31

Else

End If


End Sub
when I try to run this in debugger to test it, I get the following error

Run-Time Error '1004':
Application-defined or Object-defined Error
please explain and help.

rick mason

--
Message posted via http://www.officekb.com


Jim Thomlinson

I REQUIRE SOME HELP WITH CODE
 
What is that code supposed to do... it has both syntax and runtime issues...
--
HTH...

Jim Thomlinson


"tracks via OfficeKB.com" wrote:

The following is the code i need some help with

SUB co()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Set rng1 = Worksheets("DATE").Range("B4")
Set rng2 = Worksheets("summ").Range("A6:.cells(rows.count,3). End
(xlUp)")
Set rng3 = Worksheets("summ").Range("A6:.CELLS(ROWS.COUNT,5). End
(xlUp)")
X = 0
Y = 0

If Month(rng1) Month(rng2) Then
Range("rng3").Copy _
Worksheets("sheet3").Range("A6:E31").Offset(X, Y)

X = X + 7
Y = Y - 31

Else

End If


End Sub
when I try to run this in debugger to test it, I get the following error

Run-Time Error '1004':
Application-defined or Object-defined Error
please explain and help.

rick mason

--
Message posted via http://www.officekb.com



[email protected][_2_]

I REQUIRE SOME HELP WITH CODE
 
I notice in the following lines:
Set rng2 =
Worksheets("summ").Range("A6:.cells(rows.count,3). End (xlUp)")
Set rng3 =
Worksheets("summ").Range("A6:.CELLS(ROWS.COUNT,5). End (xlUp)")

you use ".CELLS" but I don't see a with statement to declare what these
are a part of.

Not sure if that is part of the problem, but could be part of it.

theSquirrel



On Nov 10, 11:25 am, "tracks via OfficeKB.com" <u28271@uwe wrote:
The following is the code i need some help with

SUB co()
Dim rng1 As Range
Dim rng2 As Range
Dim rng3 As Range
Set rng1 = Worksheets("DATE").Range("B4")
Set rng2 = Worksheets("summ").Range("A6:.cells(rows.count,3). End
(xlUp)")
Set rng3 = Worksheets("summ").Range("A6:.CELLS(ROWS.COUNT,5). End
(xlUp)")
X = 0
Y = 0

If Month(rng1) Month(rng2) Then
Range("rng3").Copy _
Worksheets("sheet3").Range("A6:E31").Offset(X, Y)

X = X + 7
Y = Y - 31

Else

End If

End Sub
when I try to run this in debugger to test it, I get the following error

Run-Time Error '1004':
Application-defined or Object-defined Error
please explain and help.

rick mason

--
Message posted viahttp://www.officekb.com




All times are GMT +1. The time now is 06:14 AM.

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