Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 5th, 2005, 12:16 AM
Authorized User
 
Join Date: Nov 2005
Location: phoenix, AZ, USA.
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default two questions

1) is there any . or is function that deals with the background color?
i need to use it like:
if cells(i,1).backcolor=6 then
code
endif
2)i know absolutely nothing about strings and i want to make my button idiot proof so i want it to be
if textbox.value>1000 because the minimum is 4 digits but sometimes there will be two letters on the end. so i need to know how to subtract 2 characters off of a string if the string is =6
Reply With Quote
  #2 (permalink)  
Old December 5th, 2005, 01:20 AM
Registered User
 
Join Date: Oct 2005
Location: :), :), Malaysia.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ix_ly Send a message via MSN to ix_ly
Default

Hi,

For question 1, the solution might be
range("B3").Interior.ColorIndex = 10

well, i not really understand what you're asking at question 2.

:)

ix
Reply With Quote
  #3 (permalink)  
Old December 5th, 2005, 06:33 AM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to shattered Send a message via Yahoo to shattered
Default

' Method 1
Function RightLen(sText As String) As Integer
    If Len(sText) = 6 Then
        RightLen = Left(sText, 4)
    Else
        RightLen = sText
    End If
End Function

' Method 2
Function ValidNum(sText As String) As Integer
    If IsNumeric(sText) Then
        ValidNum = sText
    Else
        ValidNum = Left(sText, 4)
    End If
End Function

In either instance just use the function to get the actual value and then test against it

Sub CheckValue()
    If RightLen(TextBox.Value) > 1000 Then
        ' Do Something....
    End If
End Sub

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.NET Interview Questions, C# Interview Questions, dotnetuncle .NET Framework 2.0 4 June 22nd, 2019 07:03 AM
C++ questions jam93 C++ Programming 1 August 19th, 2007 10:39 PM
C# questions zhenliu C# 1 April 15th, 2004 09:18 AM
questions anshul Javascript How-To 1 April 12th, 2004 07:29 AM
many questions Frank1111 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 December 22nd, 2003 09:59 PM



All times are GMT -4. The time now is 10:09 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.