Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default please help with syntax in code

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default please help with syntax in code

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Syntax in Code Ken Hudson Excel Programming 1 October 6th 06 05:22 PM
Help with Syntax in Code Tom Ogilvy Excel Programming 0 October 6th 06 04:36 PM
Syntax of VBA Code Ken Hudson Excel Programming 1 September 14th 05 10:09 PM
Syntax of this code ExcelMonkey Excel Programming 1 July 21st 05 11:29 AM
help with code/syntax Jay Baxter Excel Programming 0 February 26th 04 08:11 PM


All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"