+ Reply to Thread
Results 1 to 6 of 6

Moving Between worksheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    171

    Moving Between worksheets

    I am in worksheet "Test", and the following code is within this worksheet,
    a problem arises when I move to another worksheet "shell (S)"
    I get message "Run-time error '1004' Application-defined or object-defined error' which I believe is with the asterixed line.


    Sub printtariq()

    a = Cells.Find("WorkOrder").Column
    b = Cells.Find("CostC").Column
    c = Cells.Find("PaperSize").Column
    d = Cells.Find("PaperWeight").Column
    e = Cells.Find("NoBW").Column
    f = Cells.Find("printtype").Column

    lastrow = Range("A65500").End(xlUp).Row
    lastcol = Range("IV1").End(xlToLeft).Column
    Cells(1, lastcol + 1) = "x"
    Cells(1, lastcol + 1).Font.Bold = True
    g = Cells.Find("x").Column

    'For i = 2 To lastrow
    'Cells(i, g) = Right(Cells(i, a), Len(Cells(i, a)) - 1)
    'Next


    ***Sheets("shell (S)").Range("D23").Select












    End Sub

  2. #2
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    are you tiding up the sheet after processing by using this line?

  3. #3
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    171
    Sorry Matt, fidnt understand your question.
    After doing my processing within the "Test" worksheet I am
    then moving to the "shell(S) " worsheet.
    Hope that helps

  4. #4
    Forum Contributor
    Join Date
    12-04-2003
    Posts
    360
    That's ok.

    You could try this alternative instead...

    Sub printtariq()
    Dim xlRng as range
    set xlRng = activecell

    Then when you finished all the processes...

    activecell.select

  5. #5
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    171
    Hi trying the following based on your premise, not working, i am obviously doing something wrong

    Sub printtariq()

    Dim xlRng As Range
    Set Sheets("MORI WIP (S)").Range("D23") = ActiveCell


    a = Cells.Find("WorkOrder").Column
    b = Cells.Find("CostC").Column
    c = Cells.Find("PaperSize").Column
    d = Cells.Find("PaperWeight").Column
    e = Cells.Find("NoBW").Column
    f = Cells.Find("printtype").Column

    lastrow = Range("A65500").End(xlUp).Row
    lastcol = Range("IV1").End(xlToLeft).Column
    Cells(1, lastcol + 1) = "x"
    Cells(1, lastcol + 1).Font.Bold = True
    g = Cells.Find("x").Column

    'For i = 2 To lastrow
    'Cells(i, g) = Right(Cells(i, a), Len(Cells(i, a)) - 1)
    'Next


    ActiveCell.Select
    'Cells(2, 9) = Replace(Cells(2, 1), 1, 1, "S")

  6. #6
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    171
    Actaully , inserted code in workbook macro and works fine now, thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1