Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Make 2 Macros Work as 1

try

NewMacro() 'UN tested

For Each ws In Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" And ws.Name < "Sheet3" 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("Club Account").Range("A2:C26").ClearContents

'I don't understand what you want here but guess its for the ws?
..Range("A2:C26").ClearContents

'Application.Goto Sheets("K.Barber").Range("F3")'??

Dim cell As Range

..range("i3:i53").interior.colorindex=xlnone
For Each c In .Range("I3:I53")
If IsNumeric(c) and c.Value 5 Then .c.Interior.Color = RGB(0, 255, 0)
next c

End With
End If
Next ws
End Sub


--
Don Guillett
SalesAid Software

"Hazel" wrote in message
...
Hi All

Been trying for 3 hours to get the following 2 Macros to work together
just
keep getting errors after all my efforts, there are 26 sheets in the
workbook

Sub Macro2()

For Each ws In Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" And ws.Name < "Sheet3"
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("Club Account").Range("A2:C26").ClearContents
Application.Goto Sheets("K.Barber").Range("F3")


End With



End If

Next ws

End Sub


Sub Macro5()


Dim cell As Range

For Each cell In Range("I3:I53")
'test for a numeric value first
If IsNumeric(cell.Value) Then
'test the value of the cell
If cell.Value 5 Then
'color if greater than 5
cell.Interior.Color = RGB(0, 255, 0)
Else
'clear color if not greater than 5
cell.Interior.ColorIndex = xlNone
End If

End If

Next

End Sub

I can get them to run OK separately but Macro 5 will not run on all the
worksheets, at the same time it would also be good if when running the
macro's it sets all the column widths from Column H onwards to 15.

--
Many thanks

hazel



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Make 2 Macros Work as 1

Stick this within the with statement

..columns("h:iv").columns.columnwidth=15

--
Don Guillett
SalesAid Software

"Hazel" wrote in message
...
Hi Don

Is it that easy? of course it is when you know how eh!
Just one query what would I insert to make all column width's on every
sheet
in the workbook from Column "H" in workbook be 15 instead of the default
8.43.

Once again thank you for your time and effort it's made my day -- Merry
Christmas and a Happy New Year.



--
Many thanks

hazel


"Don Guillett" wrote:

try

NewMacro() 'UN tested

For Each ws In Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" And ws.Name < "Sheet3"
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("Club Account").Range("A2:C26").ClearContents

'I don't understand what you want here but guess its for the ws?
..Range("A2:C26").ClearContents

'Application.Goto Sheets("K.Barber").Range("F3")'??

Dim cell As Range

..range("i3:i53").interior.colorindex=xlnone
For Each c In .Range("I3:I53")
If IsNumeric(c) and c.Value 5 Then .c.Interior.Color = RGB(0, 255, 0)
next c

End With
End If
Next ws
End Sub


--
Don Guillett
SalesAid Software

"Hazel" wrote in message
...
Hi All

Been trying for 3 hours to get the following 2 Macros to work together
just
keep getting errors after all my efforts, there are 26 sheets in the
workbook

Sub Macro2()

For Each ws In Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" And ws.Name < "Sheet3"
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("Club Account").Range("A2:C26").ClearContents
Application.Goto Sheets("K.Barber").Range("F3")


End With



End If

Next ws

End Sub


Sub Macro5()


Dim cell As Range

For Each cell In Range("I3:I53")
'test for a numeric value first
If IsNumeric(cell.Value) Then
'test the value of the cell
If cell.Value 5 Then
'color if greater than 5
cell.Interior.Color = RGB(0, 255, 0)
Else
'clear color if not greater than 5
cell.Interior.ColorIndex = xlNone
End If

End If

Next

End Sub

I can get them to run OK separately but Macro 5 will not run on all the
worksheets, at the same time it would also be good if when running the
macro's it sets all the column widths from Column H onwards to 15.

--
Many thanks

hazel






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Make 2 Macros Work as 1


glad to help.
Merry/Happy "whatever turns you on"

--
Don Guillett
SalesAid Software

"Hazel" wrote in message
...
Hi Don

Thanks -- can now go on holiday a happy bunny
--
Many thanks

hazel


"Don Guillett" wrote:

Stick this within the with statement

..columns("h:iv").columns.columnwidth=15

--
Don Guillett
SalesAid Software

"Hazel" wrote in message
...
Hi Don

Is it that easy? of course it is when you know how eh!
Just one query what would I insert to make all column width's on every
sheet
in the workbook from Column "H" in workbook be 15 instead of the
default
8.43.

Once again thank you for your time and effort it's made my day -- Merry
Christmas and a Happy New Year.



--
Many thanks

hazel


"Don Guillett" wrote:

try

NewMacro() 'UN tested

For Each ws In Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" And ws.Name < "Sheet3"
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("Club Account").Range("A2:C26").ClearContents

'I don't understand what you want here but guess its for the ws?
..Range("A2:C26").ClearContents

'Application.Goto Sheets("K.Barber").Range("F3")'??

Dim cell As Range

..range("i3:i53").interior.colorindex=xlnone
For Each c In .Range("I3:I53")
If IsNumeric(c) and c.Value 5 Then .c.Interior.Color = RGB(0, 255,
0)
next c

End With
End If
Next ws
End Sub


--
Don Guillett
SalesAid Software

"Hazel" wrote in message
...
Hi All

Been trying for 3 hours to get the following 2 Macros to work
together
just
keep getting errors after all my efforts, there are 26 sheets in the
workbook

Sub Macro2()

For Each ws In Worksheets
If ws.Name < "Sheet1" And ws.Name < "Sheet2" And ws.Name <
"Sheet3"
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("Club Account").Range("A2:C26").ClearContents
Application.Goto Sheets("K.Barber").Range("F3")


End With



End If

Next ws

End Sub


Sub Macro5()


Dim cell As Range

For Each cell In Range("I3:I53")
'test for a numeric value first
If IsNumeric(cell.Value) Then
'test the value of the cell
If cell.Value 5 Then
'color if greater than 5
cell.Interior.Color = RGB(0, 255, 0)
Else
'clear color if not greater than 5
cell.Interior.ColorIndex = xlNone
End If

End If

Next

End Sub

I can get them to run OK separately but Macro 5 will not run on all
the
worksheets, at the same time it would also be good if when running
the
macro's it sets all the column widths from Column H onwards to 15.

--
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
Make 2007 macros work in 2003 SoilSaver Excel Discussion (Misc queries) 2 May 9th 11 10:14 AM
how can i make macros to work when in tools, costumize and option. MOLECULA0_0 Excel Worksheet Functions 2 May 18th 06 04:54 AM
make macros (sub) work for add-in? [email protected] Excel Programming 2 December 30th 05 03:24 AM
How can I make Excel Macros created on PC work on Macintosh? best_before Excel Worksheet Functions 1 April 28th 05 04:40 PM
How to make the macros work for different Excel versions? aiyer[_30_] Excel Programming 1 July 26th 04 12:52 PM


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