Worksheets

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

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
 
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
 
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.
 
Back
Top