Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Basic Macro help needed!

Thanks, its good to know that it is possible!

Unforntunately your code didnt seem to work...maybe due to the cell
references, but im unsu

Im going to be entering data (Mr, Mrs etc) in c11 and would want cells d11,
e11 and f11 to fill in a colour dependant upon what value was entered. Dont
know if that would make any difference.

Any help would be much appreciated!

If "Mrs
Trevor Shuttleworth wrote in message
...
Matt

your second question is a specific case of the first. Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Rows("1:1")) Is Nothing Then Exit Sub
If UCase(Target.Value) = "MR" Then _
Range(Cells(3, Target.Column), _
Cells(5, Target.Column)).Interior.ColorIndex = 45
If UCase(Target.Value) = "MRS" Then _
Range(Cells(3, Target.Column), _
Cells(5, Target.Column)).Interior.ColorIndex = 3
End Sub

Regards

Trevor


"Matt B" wrote in message
om...
Hi,

Ive just started to use macros and I would appreciate any help on the
following ideas!

1) Is it possible to have a macro "always" running...so for example
if i entered data in one cell it would automatically format/copy/etc
into another cell.

2)And secondly, is it possible to say, fill cells with a colour
dependant upon the data entered in anothercell . eg:

if a1="Mr"(or active cell=1) then cells a3 a4 and a5 would fill in
orange.
if a1="Mrs" then cells a3 a4 and a5 would fill red.

Thanks in advance for the help.

Matt





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Basic Macro help needed!

Hi,

Ive just started to use macros and I would appreciate any help on the
following ideas!

1) Is it possible to have a macro "always" running...so for example
if i entered data in one cell it would automatically format/copy/etc
into another cell.

2)And secondly, is it possible to say, fill cells with a colour
dependant upon the data entered in anothercell . eg:

if a1="Mr"(or active cell=1) then cells a3 a4 and a5 would fill in
orange.
if a1="Mrs" then cells a3 a4 and a5 would fill red.

Thanks in advance for the help.

Matt
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Basic Macro help needed!

Put this with your code into the code for "ThisWorkbook" and it will run
every time there is a change to the workbook. Careful though because
if the code itself changes the sheet, that change will trigger the same
process

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)

End Sub

As for Cell background color:

Cells(1, 3).Interior.ColorIndex = 6

6 = Yelow

Other numbers represent other colors. - Pikus


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Basic Macro help needed!

Matt

your second question is a specific case of the first. Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Rows("1:1")) Is Nothing Then Exit Sub
If UCase(Target.Value) = "MR" Then _
Range(Cells(3, Target.Column), _
Cells(5, Target.Column)).Interior.ColorIndex = 45
If UCase(Target.Value) = "MRS" Then _
Range(Cells(3, Target.Column), _
Cells(5, Target.Column)).Interior.ColorIndex = 3
End Sub

Regards

Trevor


"Matt B" wrote in message
om...
Hi,

Ive just started to use macros and I would appreciate any help on the
following ideas!

1) Is it possible to have a macro "always" running...so for example
if i entered data in one cell it would automatically format/copy/etc
into another cell.

2)And secondly, is it possible to say, fill cells with a colour
dependant upon the data entered in anothercell . eg:

if a1="Mr"(or active cell=1) then cells a3 a4 and a5 would fill in
orange.
if a1="Mrs" then cells a3 a4 and a5 would fill red.

Thanks in advance for the help.

Matt



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Basic Macro help needed!

Matt

well,first the code needs to be in the Worksheet Class module for the sheet
where you want this to work. Second, it's coded to answer the example you
quoted in your OP.

Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("C11")) Is Nothing Then Exit Sub
If UCase(Target.Value) = "MR" Then _
Range("D11:F11").Interior.ColorIndex = 45
If UCase(Target.Value) = "MRS" Then _
Range("D11:F11").Interior.ColorIndex = 3
End Sub

Regards

Trevor


"Matt B" wrote in message
...
Thanks, its good to know that it is possible!

Unforntunately your code didnt seem to work...maybe due to the cell
references, but im unsu

Im going to be entering data (Mr, Mrs etc) in c11 and would want cells

d11,
e11 and f11 to fill in a colour dependant upon what value was entered.

Dont
know if that would make any difference.

Any help would be much appreciated!

If "Mrs
Trevor Shuttleworth wrote in message
...
Matt

your second question is a specific case of the first. Try this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Rows("1:1")) Is Nothing Then Exit Sub
If UCase(Target.Value) = "MR" Then _
Range(Cells(3, Target.Column), _
Cells(5, Target.Column)).Interior.ColorIndex = 45
If UCase(Target.Value) = "MRS" Then _
Range(Cells(3, Target.Column), _
Cells(5, Target.Column)).Interior.ColorIndex = 3
End Sub

Regards

Trevor


"Matt B" wrote in message
om...
Hi,

Ive just started to use macros and I would appreciate any help on the
following ideas!

1) Is it possible to have a macro "always" running...so for example
if i entered data in one cell it would automatically format/copy/etc
into another cell.

2)And secondly, is it possible to say, fill cells with a colour
dependant upon the data entered in anothercell . eg:

if a1="Mr"(or active cell=1) then cells a3 a4 and a5 would fill in
orange.
if a1="Mrs" then cells a3 a4 and a5 would fill red.

Thanks in advance for the help.

Matt







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
Basic help needed using sumproduct to do a league table Cougarric Excel Worksheet Functions 6 May 6th 10 06:07 PM
Basic example formula needed to link between sheets add/subtract gnagy84 New Users to Excel 1 January 2nd 08 05:44 PM
Basic Macro Help [email protected] Excel Discussion (Misc queries) 1 June 7th 07 09:13 PM
Basic IF function help needed jbclem New Users to Excel 9 December 11th 06 10:51 PM
Multiply two colums; BASIC help needed wdc202 New Users to Excel 4 June 29th 06 08:39 AM


All times are GMT +1. The time now is 08:00 PM.

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"