Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Colour Cells onSheet

Hazel, I don't understand the need for 3 if statements. Why can't you
just say
If ws.Name<"Sheet 1" and ws.Name<"Sheet 2" and ws.Name <"Sheet 3"
Then
? James
Hazel wrote:
Hi All

A few days ago I used this forum and sorted out my problems with the following


Sub Macro2()
For Each ws In Worksheets
If ws.Name < "Sheet 1" Then
If ws.Name < "Sheet 2" Then
If ws.Name < "Sheet 3" Then
With ws

.Range("F3:F52").Copy .Range("H3")
.Columns("H:H").Insert Shift:=xlToRight
.Range("F3:F52").ClearContents

'what about this line for each sheet
Sheets("Sheet 1").Range("A2:C26").ClearContents
Application.Goto Sheets("Sheet 2").Range("F3")


End With
End If
End If
End If
Next ws
End Sub

To really finish the macro off and keep my boss happy, in Column H after
running the macro are numbers on the relevant rows and cells (most of the
time their are blank rows and cells between the relevant numbers) what they
would really like to happen is the numbers being deleted and the cells
changing colour so they can see at a glance who is doing the business on that
day.
--
Many thanks

hazel


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default Colour Cells onSheet

Hazel, thank you. The beauty of only one If statement is that you only
need one End If statement as well, and this will make your code much
easier to maintain. You seem to be making progress on your original
question! Best regards, James
Hazel wrote:
Hi

Cause I ain't clever I just do it - I started by just leaving out 1 sheet,
then needed to leave out another etc - so just carried on that way -- now you
have shown me the light -- I have learnt something and I thank you -- and its
in the brain box for future reference.
--
Many thanks

hazel


"Zone" wrote:

Hazel, I don't understand the need for 3 if statements. Why can't you
just say
If ws.Name<"Sheet 1" and ws.Name<"Sheet 2" and ws.Name <"Sheet 3"
Then
? James
Hazel wrote:
Hi All

A few days ago I used this forum and sorted out my problems with the following


Sub Macro2()
For Each ws In Worksheets
If ws.Name < "Sheet 1" Then
If ws.Name < "Sheet 2" Then
If ws.Name < "Sheet 3" Then
With ws

.Range("F3:F52").Copy .Range("H3")
.Columns("H:H").Insert Shift:=xlToRight
.Range("F3:F52").ClearContents

'what about this line for each sheet
Sheets("Sheet 1").Range("A2:C26").ClearContents
Application.Goto Sheets("Sheet 2").Range("F3")


End With
End If
End If
End If
Next ws
End Sub

To really finish the macro off and keep my boss happy, in Column H after
running the macro are numbers on the relevant rows and cells (most of the
time their are blank rows and cells between the relevant numbers) what they
would really like to happen is the numbers being deleted and the cells
changing colour so they can see at a glance who is doing the business on that
day.
--
Many thanks

hazel




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
colour cells using VBA Lise Excel Discussion (Misc queries) 2 February 4th 10 02:07 AM
Changing all cells in one colour to a different colour Bob Excel Discussion (Misc queries) 3 June 25th 08 02:12 PM
Cells changes colour if.... Derek Excel Worksheet Functions 1 January 23rd 08 10:40 AM
Will excel add cells using colour coding eg Add all red cells Wildwoody Excel Discussion (Misc queries) 4 October 21st 05 01:02 AM
Adding colour to a range of cells based on one of the cells v... McKenna Excel Discussion (Misc queries) 4 March 11th 05 02:25 PM


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