Question : Excel sheet auto insert data

Hi,

I have a excel which has data like this.

Srl No       Seat No              Ext No
1                 HC-1F-24           8888
2                 HC-1F-25           8889
3                HC-2F-29         8734


Colum A is the serial No   Colum B is the seat no's of the users and colum 3 is the extension
1. What i want is srl no should change autromatically
2. Seat no is a fixed field and that particular seat no will have a fixed extension no.
So what i want is that if the seat no is change the related ext no where ever it is has to come to that cell next to the seat no.
I can have the seat and ext no's in a sheet if required so that the data can be pulled from there to the main sheet.

Regards
Sharath

Answer : Excel sheet auto insert data

It is inside the CASE SELECT stament in the VB Code. You should define your matching default extension and seat number in the CASE SELECT code. I created new sample with two sheets.

http://www.geocities.com/littleantz77/ee/sample2.xls

On AUTO EXT NUMBER sheet, you enter the seat number and the default EXT NUMBER will be filled up for you.

On AUTO SEATNUMBER sheet, you enter the ext number and the default SEAT NUMBER will be filled up for you.

Here is the code. Edit this in the VBA Editor as per your required numbering.
Function SeatNumber(Ext As Variant) As Variant
Select Case Ext
    Case 1
        SeatNumber = "SEAT-001"
    Case 2
        SeatNumber = "SEAT-002"
    Case 3
        SeatNumber = "SEAT-003"
    Case 4
        SeatNumber = "SEAT-004"
    Case 5
        SeatNumber = "SEAT-005"
    Case 6
        SeatNumber = "SEAT-006"
    Case 7
        SeatNumber = "SEAT-007"
    Case 8
        SeatNumber = "SEAT-008"
    Case 9
        SeatNumber = "SEAT-009"
    Case 10
        SeatNumber = "SEAT-010"
    Case 11
        SeatNumber = "SEAT-011"
    Case 12
        SeatNumber = "SEAT-012"
    Case 13
        SeatNumber = "SEAT-013"
    Case 14
        SeatNumber = "SEAT-014"
    Case 15
        SeatNumber = "SEAT-015"
    Case 16
        SeatNumber = "SEAT-016"
    Case 17
        SeatNumber = "SEAT-017"
    Case 18
        SeatNumber = "SEAT-018"
    Case 19
        SeatNumber = "SEAT-019"
    Case 20
        SeatNumber = "SEAT-020"
    Case Else
        SeatNumber = "NOT DEFINED"
End Select
End Function

==========CODE START==============
Function ExtNumber(Seat As Variant) As Variant
Select Case Seat
    Case 1
        ExtNumber = "Ext-001"
    Case 2
        ExtNumber = "Ext-002"
    Case 3
        ExtNumber = "Ext-003"
    Case 4
        ExtNumber = "Ext-004"
    Case 5
        ExtNumber = "Ext-005"
    Case 6
        ExtNumber = "Ext-006"
    Case 7
        ExtNumber = "Ext-007"
    Case 8
        ExtNumber = "Ext-008"
    Case 9
        ExtNumber = "Ext-009"
    Case 10
        ExtNumber = "Ext-010"
    Case 11
        ExtNumber = "Ext-011"
    Case 12
        ExtNumber = "Ext-012"
    Case 13
        ExtNumber = "Ext-013"
    Case 14
        ExtNumber = "Ext-014"
    Case 15
        ExtNumber = "Ext-015"
    Case 16
        ExtNumber = "Ext-016"
    Case 17
        ExtNumber = "Ext-017"
    Case 18
        ExtNumber = "Ext-018"
    Case 19
        ExtNumber = "Ext-019"
    Case 20
        ExtNumber = "Ext-020"
    Case Else
        ExtNumber = "NOT DEFINED"
End Select
End Function
=================CODE END==============

Regarding the serial number, ssaqibh is right, you can use the =row() function minus the rows on top of your starting point.

if you want your sheet to be neat try using this formula in your serial column

=IF(OR(ISBLANK(B2),B2="NOT DEFINED"),"",ROW() - 1)
( assuming your starting point is A2)

you can immediately paste this formula all the way down. it will automatically fill itself the moment you enter your extension or seat number.

hope this helps..
Random Solutions  
 
programming4us programming4us