If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Excel 200 to excel xp - i need help!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-18-04, 06:56
warby182 warby182 is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
Question 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 08:14.
Reply With Quote
  #2 (permalink)  
Old 02-18-04, 09:57
Smitty Smitty is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 02-19-04, 16:37
warby182 warby182 is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
doesnt work ne1 else got ne ideas?
Reply With Quote
  #4 (permalink)  
Old 02-19-04, 16:51
Smitty Smitty is offline
Registered User
 
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
Reply With Quote
  #5 (permalink)  
Old 02-19-04, 16:59
warby182 warby182 is offline
Registered User
 
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!
Reply With Quote
  #6 (permalink)  
Old 02-19-04, 17:16
Smitty Smitty is offline
Registered User
 
Join Date: Dec 2003
Location: San Diego, CA
Posts: 153
Try the full sheet reference:

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

Smitty
Reply With Quote
  #7 (permalink)  
Old 02-19-04, 17:28
warby182 warby182 is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
nope im still getting the same errror
Reply With Quote
  #8 (permalink)  
Old 02-19-04, 17:50
Smitty Smitty is offline
Registered User
 
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
Reply With Quote
  #9 (permalink)  
Old 02-19-04, 17:52
warby182 warby182 is offline
Registered User
 
Join Date: Feb 2004
Posts: 5
i need B2 to qual quotationnumber because later in the code...

Sheets("Quotation Form (2)").Name = QuotationNumber
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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