Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: DIM

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    Andy Devine
    Posts
    106
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    hi i'm a bit of a novice, how do i change below so copies to, say, "sheet2" instead of adding new sheet
    thanks
    Andy


    Dim v
    Dim s As Range
    Dim c As Range
    Dim t As Range
    Dim sTitle As Range
    Dim w As Worksheet
    Set s = ActiveSheet.Range("i2")
    Set s = ActiveSheet.Range(s.End(xlToRight), s.End(xlDown))
    Set sTitle = ActiveSheet.Range("A1:H1")
    Set w = Worksheets.Add()
    Set t = w.Range("A1")
    sTitle.Range("A1:H1").Copy
    t.Range("A1:H1").PasteSpecial xlPasteValues
    For Each c In s
    Set t = t.Offset(1, 0)
    c.End(xlToLeft).Range("A1:H1").Copy
    t.Range("A1:H1").PasteSpecial xlPasteValues
    t.Offset(0, = c.End(xlUp).Value
    t.Offset(0, 9) = c.Value
    Next
    Andy Devine

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm assuming that "Sheet2" is the name of the sheet on the worksheet tab.



    Dim v
    Dim s As Range
    Dim c As Range
    Dim t As Range
    Dim sTitle As Range
    Dim w As Worksheet
    Set s = ActiveSheet.Range("i2")
    Set s = ActiveSheet.Range(s.End(xlToRight), s.End(xlDown))
    Set sTitle = ActiveSheet.Range("A1:H1")
    ' Set w = Worksheets.Add()
    ' Set t = w.Range("A1")
    sTitle.Range("A1:H1").Copy
    Sheets("Sheet2").Range("A1:H1").PasteSpecial xlPasteValues
    For Each c In s
    Set t = Sheets("Sheet2").Offset(1, 0)
    c.End(xlToLeft).Range("A1:H1").Copy
    t.Range("A1:H1").PasteSpecial xlPasteValues
    t.Offset(0, 8)= c.End(xlUp).Value
    t.Offset(0, 9) = c.Value
    Next
    I think that will work.

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Andy,

    Can't help you with this question but you were great at the Printers Devil last Friday.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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