Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i am testing the following code and get syntax error at copy line
subtest() Set rng1=worksheets("daily crane info").Range(I7,AA15:AF15) Set rng2=worksheets("crane wt summary").cells(rows.count,1).end(xlup) copy rng1 Destination = rng2.offset(1,0) end sub this is my first try at code this involved. thanks in advance for any assisstance, this sight is great for newbies like me. Rick Mason -- Message posted via http://www.officekb.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try (untested)
Sub test() Set rng1 = Worksheets("daily crane info").Range("I7,AA15:AF15") Set rng2 = Worksheets("crane wt summary").Cells(Rows.Count, 1).End(xlUp) Copy rng1.Destination = rng2.Offset(1, 0) End Sub -- Don Guillett SalesAid Software "tracks via OfficeKB.com" <u28271@uwe wrote in message news:68b186ec56283@uwe... i am testing the following code and get syntax error at copy line subtest() Set rng1=worksheets("daily crane info").Range(I7,AA15:AF15) Set rng2=worksheets("crane wt summary").cells(rows.count,1).end(xlup) copy rng1 Destination = rng2.offset(1,0) end sub this is my first try at code this involved. thanks in advance for any assisstance, this sight is great for newbies like me. Rick Mason -- Message posted via http://www.officekb.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Don Guillett wrote:
try (untested) Sub test() Set rng1 = Worksheets("daily crane info").Range("I7,AA15:AF15") Set rng2 = Worksheets("crane wt summary").Cells(Rows.Count, 1).End(xlUp) Copy rng1.Destination = rng2.Offset(1, 0) End Sub i am testing the following code and get syntax error at copy line subtest() [quoted text clipped - 9 lines] me. Rick Mason hi don i appreciate the help , i got runtime error 438 object doesn't suppoprt this property or method any other suggestions -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200611/1 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could almost (but not quite) do something like this:
Option Explicit Sub test() Dim rng1 As Range Dim rng2 As Range Set rng1 = Worksheets("daily crane info").Range("I7,AA15:AF15") Set rng2 = Worksheets("crane wt summary").Cells(Rows.Count, 1).End(xlUp) rng1.Copy _ Destination:=rng2.Offset(1, 0) End Sub But since rng1 consists of multiple areas (I7 and AA15:AF15), this will fail. Without knowing exactly what you want, maybe something like this will help: Option Explicit Sub test() Dim RngToCopy As Range Dim DestCell As Range Dim myArea As Range Dim iCtr As Long With Worksheets("daily crane info") Set RngToCopy = .Range("I7,AA15:AF15") End With With Worksheets("crane wt summary") Set DestCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0) End With iCtr = 0 For Each myArea In RngToCopy.Areas myArea.Copy _ Destination:=DestCell.Offset(0, iCtr) iCtr = iCtr + 1 Next myArea End Sub This sample may be more clear: Option Explicit Sub test() Dim DestCell As Range With Worksheets("crane wt summary") Set DestCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0) End With With Worksheets("daily crane info") .Range("I7").Copy _ Destination:=DestCell .Range("AA15:AF15").Copy _ Destination:=DestCell.Offset(0, 1) End With End Sub "tracks via OfficeKB.com" wrote: i am testing the following code and get syntax error at copy line subtest() Set rng1=worksheets("daily crane info").Range(I7,AA15:AF15) Set rng2=worksheets("crane wt summary").cells(rows.count,1).end(xlup) copy rng1 Destination = rng2.offset(1,0) end sub this is my first try at code this involved. thanks in advance for any assisstance, this sight is great for newbies like me. Rick Mason -- Message posted via http://www.officekb.com -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave Peterson wrote:
You could almost (but not quite) do something like this: Option Explicit Sub test() Dim rng1 As Range Dim rng2 As Range Set rng1 = Worksheets("daily crane info").Range("I7,AA15:AF15") Set rng2 = Worksheets("crane wt summary").Cells(Rows.Count, 1).End(xlUp) rng1.Copy _ Destination:=rng2.Offset(1, 0) End Sub But since rng1 consists of multiple areas (I7 and AA15:AF15), this will fail. Without knowing exactly what you want, maybe something like this will help: Option Explicit Sub test() Dim RngToCopy As Range Dim DestCell As Range Dim myArea As Range Dim iCtr As Long With Worksheets("daily crane info") Set RngToCopy = .Range("I7,AA15:AF15") End With With Worksheets("crane wt summary") Set DestCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0) End With iCtr = 0 For Each myArea In RngToCopy.Areas myArea.Copy _ Destination:=DestCell.Offset(0, iCtr) iCtr = iCtr + 1 Next myArea End Sub This sample may be more clear: Option Explicit Sub test() Dim DestCell As Range With Worksheets("crane wt summary") Set DestCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0) End With With Worksheets("daily crane info") .Range("I7").Copy _ Destination:=DestCell .Range("AA15:AF15").Copy _ Destination:=DestCell.Offset(0, 1) End With End Sub HI Dave: I did not follow your first example of code, so I used the second. I got a complier error at destination:= syntax eror , i do not understand looks ok to me . if you have any further suggests iam always here. soory i am so long getting back to you rick mason i am testing the following code and get syntax error at copy line subtest() [quoted text clipped - 11 lines] -- Message posted via http://www.officekb.com -- Message posted via http://www.officekb.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It worked ok for me. Did you change the code?
"tracks via OfficeKB.com" wrote: Dave Peterson wrote: You could almost (but not quite) do something like this: Option Explicit Sub test() Dim rng1 As Range Dim rng2 As Range Set rng1 = Worksheets("daily crane info").Range("I7,AA15:AF15") Set rng2 = Worksheets("crane wt summary").Cells(Rows.Count, 1).End(xlUp) rng1.Copy _ Destination:=rng2.Offset(1, 0) End Sub But since rng1 consists of multiple areas (I7 and AA15:AF15), this will fail. Without knowing exactly what you want, maybe something like this will help: Option Explicit Sub test() Dim RngToCopy As Range Dim DestCell As Range Dim myArea As Range Dim iCtr As Long With Worksheets("daily crane info") Set RngToCopy = .Range("I7,AA15:AF15") End With With Worksheets("crane wt summary") Set DestCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0) End With iCtr = 0 For Each myArea In RngToCopy.Areas myArea.Copy _ Destination:=DestCell.Offset(0, iCtr) iCtr = iCtr + 1 Next myArea End Sub This sample may be more clear: Option Explicit Sub test() Dim DestCell As Range With Worksheets("crane wt summary") Set DestCell = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0) End With With Worksheets("daily crane info") .Range("I7").Copy _ Destination:=DestCell .Range("AA15:AF15").Copy _ Destination:=DestCell.Offset(0, 1) End With End Sub HI Dave: I did not follow your first example of code, so I used the second. I got a complier error at destination:= syntax eror , i do not understand looks ok to me . if you have any further suggests iam always here. soory i am so long getting back to you rick mason i am testing the following code and get syntax error at copy line subtest() [quoted text clipped - 11 lines] -- Message posted via http://www.officekb.com -- Message posted via http://www.officekb.com -- Dave Peterson |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dave Peterson wrote:
It worked ok for me. Did you change the code? You could almost (but not quite) do something like this: [quoted text clipped - 66 lines] -- Message posted via http://www.officekb.com HI, DAVE : I dod not change the code , i will recheck for type-O's and try again. thank very much for you help -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200611/1 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you still have trouble, post the your current code.
"tracks via OfficeKB.com" wrote: Dave Peterson wrote: It worked ok for me. Did you change the code? You could almost (but not quite) do something like this: [quoted text clipped - 66 lines] -- Message posted via http://www.officekb.com HI, DAVE : I dod not change the code , i will recheck for type-O's and try again. thank very much for you help -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200611/1 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help with Syntax in Code | Excel Programming | |||
Help with Syntax in Code | Excel Programming | |||
Syntax of VBA Code | Excel Programming | |||
Syntax of this code | Excel Programming | |||
help with code/syntax | Excel Programming |