Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Formatting and Worksheet_Change

Hi There,
I am new here so let's see...

I am having hard time trying to make VBA code.
I am trying to make a code that will check range B4:AZ4 and if there is a
value 7, it will make cells from row 5 to row e.g. 500 "7" coloured as grey.
I am able to get this far, but it should work out when there are changes in
rows 5 to 500. I want it work when I drag and drop/enter values/delete values
to run this.

Please, Help me, I am going nuts over this.... Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Formatting and Worksheet_Change

Sorry, I will add my code he
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, rng2 As Range
Dim rCell As Range
Dim i As Long
Dim arr As Variant

Const Month As String = "7"

Set rng = Me.Range("B4:AZ4")

If Not Intersect(Target, rng) Is Nothing Then

For Each rCell In rng.Cells
If UCase(rCell.Value) = Month Then
rCell(2).Resize(500).Interior.ColorIndex = 15

Else
rCell(2).Resize(500).Interior.ColorIndex = xlNone

End If

Next
End If

End Sub

I also want to make another format for number 12 :o)

Thanks...

"MakeLei" wrote:

Hi There,
I am new here so let's see...

I am having hard time trying to make VBA code.
I am trying to make a code that will check range B4:AZ4 and if there is a
value 7, it will make cells from row 5 to row e.g. 500 "7" coloured as grey.
I am able to get this far, but it should work out when there are changes in
rows 5 to 500. I want it work when I drag and drop/enter values/delete values
to run this.

Please, Help me, I am going nuts over this.... Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Formatting and Worksheet_Change

So what isn't working with your current solution?

--
Regards,
Tom Ogilvy


"MakeLei" wrote:

Sorry, I will add my code he
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, rng2 As Range
Dim rCell As Range
Dim i As Long
Dim arr As Variant

Const Month As String = "7"

Set rng = Me.Range("B4:AZ4")

If Not Intersect(Target, rng) Is Nothing Then

For Each rCell In rng.Cells
If UCase(rCell.Value) = Month Then
rCell(2).Resize(500).Interior.ColorIndex = 15

Else
rCell(2).Resize(500).Interior.ColorIndex = xlNone

End If

Next
End If

End Sub

I also want to make another format for number 12 :o)

Thanks...

"MakeLei" wrote:

Hi There,
I am new here so let's see...

I am having hard time trying to make VBA code.
I am trying to make a code that will check range B4:AZ4 and if there is a
value 7, it will make cells from row 5 to row e.g. 500 "7" coloured as grey.
I am able to get this far, but it should work out when there are changes in
rows 5 to 500. I want it work when I drag and drop/enter values/delete values
to run this.

Please, Help me, I am going nuts over this.... Thanks in advance.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Formatting and Worksheet_Change

Hi and thanks for fast reply,
How would I be able to activate the code when there are changes in rows 5
to 500... Otherwise it works well.
BR
MakeLei

"Tom Ogilvy" wrote:

So what isn't working with your current solution?

--
Regards,
Tom Ogilvy


"MakeLei" wrote:

Sorry, I will add my code he
Private Sub Worksheet_Change(ByVal Target As Range)

Dim rng As Range, rng2 As Range
Dim rCell As Range
Dim i As Long
Dim arr As Variant

Const Month As String = "7"

Set rng = Me.Range("B4:AZ4")

If Not Intersect(Target, rng) Is Nothing Then

For Each rCell In rng.Cells
If UCase(rCell.Value) = Month Then
rCell(2).Resize(500).Interior.ColorIndex = 15

Else
rCell(2).Resize(500).Interior.ColorIndex = xlNone

End If

Next
End If

End Sub

I also want to make another format for number 12 :o)

Thanks...

"MakeLei" wrote:

Hi There,
I am new here so let's see...

I am having hard time trying to make VBA code.
I am trying to make a code that will check range B4:AZ4 and if there is a
value 7, it will make cells from row 5 to row e.g. 500 "7" coloured as grey.
I am able to get this far, but it should work out when there are changes in
rows 5 to 500. I want it work when I drag and drop/enter values/delete values
to run this.

Please, Help me, I am going nuts over this.... Thanks in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_Change Dan Excel Programming 5 November 16th 05 07:37 PM
Worksheet_Change [email protected] Excel Programming 2 November 22nd 04 12:17 AM
More Then one Worksheet_Change pauluk[_7_] Excel Programming 2 March 2nd 04 01:38 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


All times are GMT +1. The time now is 08:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"