Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Problem with cells color VB

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 02-06-2009
Member
 
Join Date: Jun 2009
Posts: 3
Problem with cells color VB
  

Hi,
I have a table with changing length of the rows and columns and sums at the end of each row/table/diagonal. I want to put some color to the table, but I get error 438 - Object doesn't support this property or method. Here is the code I have:
Code:
Sub ColorSet()

Dim cLL As Range, Rg As Range
  Application.ScreenUpdating = False
 For Each cLL In Range("A1:P10")
  If IsEmpty(cLL) Then
   With cLL.Interior
   .ColorIndex = 0
   .Pattern = xlSolid
   End With
  Else
  With cLL.Interior
  .ColorIndex = 3
  .Pattern = xlSolid
  .LineStyle = xlContinuous
  End With
   End If
 Next cLL
 Application.ScreenUpdating = True
   
   End Sub
Could you help me as I can't figure out what the problem is...

Reply With Quote
  #2  
Old 03-06-2009
Member
 
Join Date: Feb 2008
Posts: 194
Re: Problem with cells color VB

Microsoft has confirmed this to be a bug in the Microsoft products. There are two possible workarounds for this problem.

- Access the form directly rather than by a variable containing the form.

OR

- Create property procedures in the form's code to provide access to the properties of the controls on the form.
Reply With Quote
  #3  
Old 03-06-2009
Member
 
Join Date: Jun 2009
Posts: 3
Re: Problem with cells color VB

Could you explain the worarounds in more details?
Reply With Quote
  #4  
Old 03-06-2009
Member
 
Join Date: Feb 2009
Posts: 96
Re: Problem with cells color VB

Which version of VB are you using... I have run into all kinds of errors in VB.net 2008. One big problem was the way it colors things instead of putting

x
.background.color.RED
. some other property
. some other property

i had to type the item lets say
x.background.color.RED
x.some other property
x. some other property
Reply With Quote
  #5  
Old 03-06-2009
Member
 
Join Date: Jun 2009
Posts: 3
Re: Problem with cells color VB

The version is Microsoft Visual Basic 6.5
So do I understand right that you mean putting it this way?
Code:
Sub ColorSet()
Dim cLL As Range, Rg As Range
'Set Rg = Range("A1:P10")
  Application.ScreenUpdating = False
 For Each cLL In Range("A1:P10")
  If IsEmpty(cLL) Then
   cLL.Interior.ColorIndex = 0
   cLL.Interior.Pattern = xlSolid
  Else
   cLL.Interior.ColorIndex = 3
  cLL.Interior.Pattern = xlSolid
  cLL.Interior.LineStyle = xlContinuous
   End If
 Next cLL
 Application.ScreenUpdating = True
   
   End Sub
If yes - it gives me the same mistake...
Reply With Quote
  #6  
Old 03-06-2009
Member
 
Join Date: Feb 2009
Posts: 96
Re: Problem with cells color VB

no that only works in vb.net--- I threw that out there in case you were using VB.net
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Problem with cells color VB"
Thread Thread Starter Forum Replies Last Post
Not able to change font color in some cells of Microsoft Excel Garsen's MS Office Support 2 01-02-2012 01:08 PM
how can i highlight cells with color, which contain duplicates form a separate excel sheet guigey Windows Software 3 01-06-2010 04:31 AM
Problem with color attribute in CSS Carey Software Development 5 14-01-2010 12:20 AM
Problem to combine the values of cells in the order windows_user Software Development 4 16-04-2009 11:35 PM
Problem with color pictures. Dietrich Monitor & Video Cards 3 17-02-2009 09:45 AM


All times are GMT +5.5. The time now is 02:26 AM.