#1   Report Post  
Mark
 
Posts: n/a
Default 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   Report Post  
OJ
 
Posts: n/a
Default

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   Report Post  
mark
 
Posts: n/a
Default

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to protect and unprotect 30 worksheets in a file every month . Protect & Unprotect Several Worksheets Excel Worksheet Functions 4 January 10th 05 01:29 PM
Protect/unprotect all worksheets Janna Excel Worksheet Functions 2 January 7th 05 01:01 AM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM
data entry on multiple worksheets diosdias Excel Discussion (Misc queries) 1 December 7th 04 05:33 PM
Assigning Cells in worksheets to other data in other worksheets. David McRitchie Excel Discussion (Misc queries) 0 November 27th 04 06:15 PM


All times are GMT +1. The time now is 06:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"