Results 1 to 9 of 9
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Question Unanswered: Excel 2000 to Excel XP - i need help!!

    i am currently workin on a project at college for my a levels. at my college we have computers that run windows 98 and excel 2000. when i bring my work home to my pc, i have windows xp and excel xp, and much of the code isnt workin. is there a reason for this? i am really stuck, and i am currently stuck in an office attempting to get it to work. help!!!!

    this is the part of code that isnt working

    ActiveSheet.Unprotect 'Unprotect the main sheet
    [B2] = [B2] + 1 'Add 1 to the cell B2
    QuotationNumber = [B2] 'The cell named quotation number is equal to the cell B4

    any part of my vb project that contains square brackets doesnt work, what can i do? even the simple input boxes dont work

    [B7] = InputBox("Enter Customers Name")
    [C7] = InputBox("Enter Customers Address")
    [D7] = InputBox("Enter Customers Postcode")
    [F7] = InputBox("Enter Customers Home Number")
    [G7] = InputBox(" Enter Customers Mobile Number")

    the errors are appearing where the square brakcets are....is there anybody out there who can help me?
    Last edited by warby182; 02-18-04 at 09:14.

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    Welcome to the Board!

    You could nest your cell references like so:

    Code:
    With Sheets("Sheet1")
      Range("B7") = InputBox
      Range("C7") = InputBox
      ' Etc
    And use the full sheet/range reference - Sheets("Sheet1").Range("A1")

    Hope that helps,

    Smitty

  3. #3
    Join Date
    Feb 2004
    Posts
    5
    doesnt work ne1 else got ne ideas?

  4. #4
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    BNoth of the following worked just fine for me on Office 2000:
    Code:
    Sub Test()
    
        ActiveSheet.Unprotect
            
            [B2] = [B2] + 1
            QuotationNumber = [B2]
            [B7] = InputBox("Enter Customers Name")
            [C7] = InputBox("Enter Customers Address")
            [D7] = InputBox("Enter Customers Postcode")
            [F7] = InputBox("Enter Customers Home Number")
            [G7] = InputBox(" Enter Customers Mobile Number")
    
    End Sub
    
    Sub Test1()
        
        ActiveSheet.Unprotect
            
            With Sheets("Sheet1")
                .Range("B7") = InputBox("Enter Customers Name")
                .Range("C7") = InputBox("Enter Customers Address")
                .Range("D7") = InputBox("Enter Customers Postcode")
                .Range("F7") = InputBox("Enter Customers Home Number")
                .Range("G7") = InputBox(" Enter Customers Mobile Number")
                .Range("B2") = .Range("B2") + 1
            End With
            
            QuotationNumber = Sheets("Sheet1").Range("B2")
            
    End Sub
    Hope that helps,

    Smitty

  5. #5
    Join Date
    Feb 2004
    Posts
    5
    Cheers M8!!!!!!

    the only bit that wont work now is

    QuotationNumber = Range("B2")

    its sayin compile error, cannot find project ro library! im stuck!

  6. #6
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    Try the full sheet reference:

    QuotationNumber = Sheets("Sheet1").Range("B2")

    Smitty

  7. #7
    Join Date
    Feb 2004
    Posts
    5
    nope im still getting the same errror

  8. #8
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    Maybe:

    Sheets("Sheet1").Range("B4") = Sheets("Sheet1").Range("B2")

    Are you sure that B4 is named the same as in the code?

    Smitty

  9. #9
    Join Date
    Feb 2004
    Posts
    5
    i need B2 to qual quotationnumber because later in the code...

    Sheets("Quotation Form (2)").Name = QuotationNumber

Posting Permissions

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