ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Missing something in my code... (https://www.excelbanter.com/excel-programming/365094-missing-something-my-code.html)

Turquoise_dax[_14_]

Missing something in my code...
 

I want each cell right to a cell containing "I" in the column B to be
filled with a pattern. What's missing?

(The call of the pattern is also wrong...)


Dim cell As Range
For Each cell In Range("B:B")
If cell = "I" Then *(XXX)*.Offset(0, 1).*Fill.Patterned
msoPattern50Percent*
Next


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=554613


Toppers

Missing something in my code...
 
Try (change pattern to suit):

Dim cell As Range
For Each cell In Range("B:B")
If cell = "I" Then
cell.Offset(0, 1).Interior.Pattern = xlGray50
End If
Next

"Turquoise_dax" wrote:


I want each cell right to a cell containing "I" in the column B to be
filled with a pattern. What's missing?

(The call of the pattern is also wrong...)


Dim cell As Range
For Each cell In Range("B:B")
If cell = "I" Then *(XXX)*.Offset(0, 1).*Fill.Patterned
msoPattern50Percent*
Next


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=554613



Piotr Lipski

Missing something in my code...
 
On Thu, 22 Jun 2006 10:34:16 -0500, Turquoise_dax wrote:

I want each cell right to a cell containing "I" in the column B to be
filled with a pattern. What's missing?

(The call of the pattern is also wrong...)


Dim cell As Range
For Each cell In Range("B:B")
If cell = "I" Then *(XXX)*.Offset(0, 1).*Fill.Patterned
msoPattern50Percent*
Next


Consider conditional formatting.

If CF is not suitable for you (because, let's say, you have REALLY huge
amounts of data and REALLY slow computer), use:

If cell.Value = "I" Then cell.Offset(0, 1).Interior.Pattern=xlGray50

--
PL

Jim Jackson

Missing something in my code...
 
This might work for you:

Columns("B").Select
Selection.AutoFilter Field:=1, Criteria1:="=I", Operator:=xlAnd
Columns("C").Select
Selection.Interior.Pattern = xlGray50

Jim


"Turquoise_dax" wrote:


I want each cell right to a cell containing "I" in the column B to be
filled with a pattern. What's missing?

(The call of the pattern is also wrong...)


Dim cell As Range
For Each cell In Range("B:B")
If cell = "I" Then *(XXX)*.Offset(0, 1).*Fill.Patterned
msoPattern50Percent*
Next


--
Turquoise_dax
------------------------------------------------------------------------
Turquoise_dax's Profile: http://www.excelforum.com/member.php...o&userid=35185
View this thread: http://www.excelforum.com/showthread...hreadid=554613




All times are GMT +1. The time now is 11:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com