Results 1 to 8 of 8

Thread: [RESOLVED] Selection Range in Excel as object variable

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2009
    Posts
    4

    Resolved [RESOLVED] Selection Range in Excel as object variable

    I want to select a range of cells of about 1 to 10 rows and 5 to 50 columns from one workbook and based on that selection will set the values in a different workbook. Here is my code that I cannot make work.

    Code:
    Public Sub DataTransferTwo()
        Dim MyRange As Range
        Dim Pname As String
        Dim Loc As String
        Dim Clt As String
        Dim MyDate As Date
        '
     Workbooks("Master Project Status.xls").Worksheets "Proposals").Activate
            Set MyRange = Selection.Value        (This is far as I get then errors-Object Required or Wrong Method/Property)
            With MyRange
            MyDate = MyRange("", Range("B1").End(xlDown).Value)
            Pname = MyRange("", Range("D1").End(xlDown).Value)
            Clt = MyRange("", Range("E1").End(xlDown).Value)
            Loc = MyRange("", Range("G1").End(xlDown).Value)
           End With
        '
        Workbooks("Proposal Tracking.xlsx").Worksheets("ACT").Activate
        Range("B4000").End(xlUp).Offset(1, 0).Select
        Selection = Pname
        Range("D4000").End(xlUp).Offset(1, 0).Select
        Selection = Clt
        Range("E4000").End(xlUp).Offset(1, 0).Select
        Selection = Loc
        Range("G4000").End(xlUp).Offset(1, 0).Select
        Selection = MyDate
    
    End Sub
    Any help would be greatly appreciated
    Last edited by RobDog888; Jul 20th, 2009 at 12:26 PM. Reason: Not Sure where this should be posted to what forum

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width