Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Background colour using VB

cells.Interior.ColorIndex = 1


activeworkbook.close SaveChanges:=False


--
Regards,
Tom Ogilvy

"La Durande" wrote in message
...
I wish to make make the background colour of all cells black prior to

paste
of an invoice details. I code upto now is as below but I need to add the
background colur and then wish to close the workbook with code

Range("A2:M73").Select
Selection.Copy
Workbooks.Add
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=False

Application.CutCopyMode = False
Filesavename = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

If Filesavename < False Then
ActiveSheet.SaveAs Filename:=Filesavename, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

End If

End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Background colour using VB

Doesn't seem to work and give error code 438
Object doesn't support this property or method

"Tom Ogilvy" wrote:

cells.Interior.ColorIndex = 1


activeworkbook.close SaveChanges:=False


--
Regards,
Tom Ogilvy

"La Durande" wrote in message
...
I wish to make make the background colour of all cells black prior to

paste
of an invoice details. I code upto now is as below but I need to add the
background colur and then wish to close the workbook with code

Range("A2:M73").Select
Selection.Copy
Workbooks.Add
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=False

Application.CutCopyMode = False
Filesavename = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

If Filesavename < False Then
ActiveSheet.SaveAs Filename:=Filesavename, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

End If

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Background colour using VB

Works fine for me.

If you are using Excel 97 and doing it from a Commandbutton, then change the
takefocusonclick property to False.


--
Regards,
Tom Ogilvy

"La Durande" wrote in message
...
Doesn't seem to work and give error code 438
Object doesn't support this property or method

"Tom Ogilvy" wrote:

cells.Interior.ColorIndex = 1


activeworkbook.close SaveChanges:=False


--
Regards,
Tom Ogilvy

"La Durande" wrote in message
...
I wish to make make the background colour of all cells black prior to

paste
of an invoice details. I code upto now is as below but I need to add

the
background colur and then wish to close the workbook with code

Range("A2:M73").Select
Selection.Copy
Workbooks.Add
Range("A2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=False

Application.CutCopyMode = False
Filesavename = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")

If Filesavename < False Then
ActiveSheet.SaveAs Filename:=Filesavename, FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=False

End If

End Sub






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
Change background colour hollies Excel Worksheet Functions 3 October 8th 09 11:54 PM
Sheet Background Colour Kaye Excel Discussion (Misc queries) 2 February 12th 07 02:15 AM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
How to filter using background colour? chrisk Excel Worksheet Functions 1 February 13th 06 03:38 PM
Count if - background colour & value Glenn Excel Programming 1 September 1st 03 05:47 AM


All times are GMT +1. The time now is 11:36 PM.

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

About Us

"It's about Microsoft Excel"