Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete row data and cell colour


Is it possible to write a macro for say if cell A1 is equal to say word
such as sick, then the cells b1-g1 would have all data removed?


--
alex1982
------------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...o&userid=37494
View this thread: http://www.excelforum.com/showthread...hreadid=573248

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Delete row data and cell colour

Sure...


If Range("A1").Value = "sick" Then
Range("B1:G1").ClearContents
End If



alex1982 wrote:
Is it possible to write a macro for say if cell A1 is equal to say word
such as sick, then the cells b1-g1 would have all data removed?


--
alex1982
------------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...o&userid=37494
View this thread: http://www.excelforum.com/showthread...hreadid=573248


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default Delete row data and cell colour

Without using the Lcase() twice below in the code presented
"Sick" is not "sick"
"SICK" is not "Sink"
etc...
So I'd use:

Sub tester()
If LCase(Range("A1").Value) = LCase("sick") Then
Range("B1:G1").ClearContents
End If
End Sub




" wrote:

Sure...


If Range("A1").Value = "sick" Then
Range("B1:G1").ClearContents
End If



alex1982 wrote:
Is it possible to write a macro for say if cell A1 is equal to say word
such as sick, then the cells b1-g1 would have all data removed?


--
alex1982
------------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...o&userid=37494
View this thread: http://www.excelforum.com/showthread...hreadid=573248



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete row data and cell colour


Can i also get it to clear the cell colour

--
alex198
-----------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...fo&userid=3749
View this thread: http://www.excelforum.com/showthread.php?threadid=57324

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default Delete row data and cell colour

What cell color? You don't furnish any details, such as:
What cells are colored? Cell Addresses, please
How are they colored? 1) Manually using Fill-Color Icon
or 2) using Conditional Formatting?


"alex1982" wrote:


Can i also get it to clear the cell colour?


--
alex1982
------------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...o&userid=37494
View this thread: http://www.excelforum.com/showthread...hreadid=573248




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Delete row data and cell colour


A1 is a drop down menu with 2 choice. when nothing is selected i want t
be able to choose the cell colours of B1-G1 myself. as i have a macro t
count cells by cell colour. However, when one of these options i
selected i want it to delete all the cell info and colours from B1-G1

--
alex198
-----------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...fo&userid=3749
View this thread: http://www.excelforum.com/showthread.php?threadid=57324

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Delete row data and cell colour

Sure thing, add one (or both) of these lines:


Range("B1:G1").Interior.ColorIndex = xlNone 'clears background
color
Range("B1:G1").Font.ColorIndex = 0 'set font color to Automatic

Your request seems pretty straight-forward to me.

alex1982 wrote:
A1 is a drop down menu with 2 choice. when nothing is selected i want to
be able to choose the cell colours of B1-G1 myself. as i have a macro to
count cells by cell colour. However, when one of these options is
selected i want it to delete all the cell info and colours from B1-G1.


--
alex1982
------------------------------------------------------------------------
alex1982's Profile: http://www.excelforum.com/member.php...o&userid=37494
View this thread: http://www.excelforum.com/showthread...hreadid=573248


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
Data Validation - Cell Colour ray963 Excel Discussion (Misc queries) 3 November 17th 08 06:54 PM
Formatting Data in cell in colour [email protected] Excel Discussion (Misc queries) 3 January 28th 08 03:28 PM
can the fill colour of a bar be tied to the data font colour data PaulC Charts and Charting in Excel 0 June 23rd 06 01:21 AM
How to enter a colour in a cell & not data ? Mark Excel Discussion (Misc queries) 0 July 22nd 05 12:15 PM
Sorting data by Cell Colour Andy Chan Excel Programming 1 September 2nd 04 09:48 AM


All times are GMT +1. The time now is 10:23 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"