+ Reply to Thread
Results 1 to 3 of 3

[SOLVED] Worksheets

  1. #1
    Mark
    Guest

    [SOLVED] Worksheets

    Hi

    If I have the following macro running in worksheet 1.

    Option Explicit
    Sub RCA()

    ActiveSheet.UsedRange
    If Range("A1").Value = "" Then
    Range("A1").Value = InputBox("Enter starting
    value")
    Else
    Range("A1").SpecialCells
    (xlCellTypeLastCell).Offset(1, 0).Value =
    Application.WorksheetFunction.Max(Range("A:A")) + 1
    End If
    End Sub

    How can I adjust the macro to run in worksheet 2 & 3. If
    I want worksheet 2 to start with PCI1 then PCI2 and so on
    and then worksheet 3 to start with PCICR1 then PCICR2.

    Thanks

    Mark


  2. #2
    OJ
    Guest

    Re: Worksheets

    Hi,
    Not sure what you mean by PCI1, PCI2 etc but you can qualify ranges
    with workbook and worksheet references like this

    Thisworkbook.Sheets(1).Range("A1")...

    Also, what are you trying to do with the line
    ActiveSheet.UsedRange

    It won't do anything in this case..

    Hth
    OJ


  3. #3
    mark
    Guest

    Re: Worksheets

    Hi

    I am new to all this.
    What I am trying to achieve is this.
    To open a workbook with three worksheets, the all
    worksheets will have the following headings in A1(Batch
    No), B1(Date Sent), C1(Amount) & D1(Date Paid).
    In worksheet one when you click the command button I
    would like to generate a numeric number which would
    appear in A2, then if I require a further number this
    time when I click the command button the next number
    would appear in A2.
    In sheet 2 I would like the same to happen except the
    batch number in cell A2, A3, A4 etc need to start with
    the ref PCI followed by the first number for example
    (PCI1, PCI2, PCI3 and so on).
    I would like the same thing to happen in sheet 3 however
    the ref in cell A2 A3, A4 etc need to start with the ref
    PCICR followed by the first number for example (PCICR1,
    PCICR2, PCICR3 and so on).
    Hope you can understand this thanks for your help.

    >-----Original Message-----
    >Hi,
    >Not sure what you mean by PCI1, PCI2 etc but you can

    qualify ranges
    >with workbook and worksheet references like this
    >
    >Thisworkbook.Sheets(1).Range("A1")...
    >
    >Also, what are you trying to do with the line
    >ActiveSheet.UsedRange
    >
    >It won't do anything in this case..
    >
    >Hth
    >OJ
    >
    >.
    >


+ 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