Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Help, Code won't work and I have no clue

I am trying to take data from from a Sheet called %Efficiency and past it
into a sheet Called MMM11. I the problem is in my selecion of the the range
to copy. I don't know why it won't work. The only problem that i was
thinking it could be is that cells A1-C1 do not contain a date where as the
rest of the row 1 does. I don't know though please help.

Dim X As Integer, Y As Integer
For X = 1 To 100
If Cells(1, X) < Date Then Y = X
Next
Sheets("%Efficiency").Select
Selection.Range(Cells(1, Y + 1), Cells(3, Y - 19)).Select
Selection.Copy
Sheets("MMM11").Select
ActiveSheet.Range("B19").Select
Selection.PasteSpecial (xlPasteValuesAndNumberFormats)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Help, Code won't work and I have no clue

Not tested, but probably

Dim X As Integer, Y As Integer
For X = 1 To 100
If Cells(1, X) < Date Then Y = X
Next
Sheets("%Efficiency").Select
Range(Cells(1, Y + 1), Cells(3, Y - 19)).Copy
Sheets("MMM11").Select
ActiveSheet.Range("B19").Select
Selection.PasteSpecial (xlPasteValuesAndNumberFormats)

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Lost and Looking for Help"
wrote in message
...
I am trying to take data from from a Sheet called %Efficiency and past it
into a sheet Called MMM11. I the problem is in my selecion of the the

range
to copy. I don't know why it won't work. The only problem that i was
thinking it could be is that cells A1-C1 do not contain a date where as

the
rest of the row 1 does. I don't know though please help.

Dim X As Integer, Y As Integer
For X = 1 To 100
If Cells(1, X) < Date Then Y = X
Next
Sheets("%Efficiency").Select
Selection.Range(Cells(1, Y + 1), Cells(3, Y - 19)).Select
Selection.Copy
Sheets("MMM11").Select
ActiveSheet.Range("B19").Select
Selection.PasteSpecial (xlPasteValuesAndNumberFormats)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Help, Code won't work and I have no clue

when you do select.Range

then you are anchoring your range to the currently active cell and
offsetting from there.

so (as an example)
Range("Z1").Select
Selection.Range("A1:C1").copy

would copy Z1:AB1

I doubt that is your intent. Try:

Dim X As Integer, Y As Integer
With Sheets("%Efficiency")
For X = 1 To 100
If .Cells(1, X) < Date Then
Y = X
end if
Next
.Range(.Cells(1, Y + 1), .Cells(3, Y - 19)).Copy
End With
Sheets("MMM11").Range("B19").PasteSpecial _
xlPasteValuesAndNumberFormats
--
Regards,
Tom Ogilvy



"Lost and Looking for Help" wrote:

I am trying to take data from from a Sheet called %Efficiency and past it
into a sheet Called MMM11. I the problem is in my selecion of the the range
to copy. I don't know why it won't work. The only problem that i was
thinking it could be is that cells A1-C1 do not contain a date where as the
rest of the row 1 does. I don't know though please help.

Dim X As Integer, Y As Integer
For X = 1 To 100
If Cells(1, X) < Date Then Y = X
Next
Sheets("%Efficiency").Select
Selection.Range(Cells(1, Y + 1), Cells(3, Y - 19)).Select
Selection.Copy
Sheets("MMM11").Select
ActiveSheet.Range("B19").Select
Selection.PasteSpecial (xlPasteValuesAndNumberFormats)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Help, Code won't work and I have no clue

I don't understand this part. If on sheet %efficiency you can delete
"Sheets("%Efficiency")."
For X = 1 To 100
If Cells(1, X) < Date Then Y = X
Next
======maybe

y=cells(1,256).end(xltoleft).column
'then withOUT selections
Sheets("%Efficiency").Range(Cells(1, Y + 1), Cells(3, Y - 19)).Copy
Sheets("MMM11").Range("B19").PasteSpecial (xlPasteValuesAndNumberFormats)

--
Don Guillett
SalesAid Software

"Lost and Looking for Help"
wrote in message
...
I am trying to take data from from a Sheet called %Efficiency and past it
into a sheet Called MMM11. I the problem is in my selecion of the the
range
to copy. I don't know why it won't work. The only problem that i was
thinking it could be is that cells A1-C1 do not contain a date where as
the
rest of the row 1 does. I don't know though please help.

Dim X As Integer, Y As Integer
For X = 1 To 100
If Cells(1, X) < Date Then Y = X
Next
Sheets("%Efficiency").Select
Selection.Range(Cells(1, Y + 1), Cells(3, Y - 19)).Select
Selection.Copy
Sheets("MMM11").Select
ActiveSheet.Range("B19").Select
Selection.PasteSpecial (xlPasteValuesAndNumberFormats)



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
I have no clue about how to use vba amy howell Excel Discussion (Misc queries) 0 May 6th 08 01:31 AM
Not a clue of which function to use! y_not Excel Discussion (Misc queries) 1 April 11th 06 07:23 PM
No Clue... tahir Excel Programming 3 March 22nd 06 12:44 PM
I have not got a clue emailreynolds Excel Discussion (Misc queries) 1 August 25th 05 06:12 PM
any clue? vikram Excel Programming 2 April 29th 04 04:04 PM


All times are GMT +1. The time now is 07:55 AM.

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"