Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Making worksheets

Hi. I have a makro that displays a userform that can generate a report. The
report is to be created when the user presses a button on the user form. The
report is to be shown in a new worksheet that the program creates. I want the
new worksheet to have certain settings (e.g. no gridlines). I am trying to
write code for this but I do not know how to refer to the worksheet without
using the very unconvenient code when setting one worksheet active and then
applying the changes. Code:

Private Sub worksheetMaker()
Dim WB As Workbook
Dim SH As Worksheet
Dim iCtr As Long
Const sName As String = "Rapport "
Set WB = ActiveWorkbook
iCtr = WB.Worksheets.Count
Set SH = Worksheets.Add(after:=Worksheets(iCtr))
SH.Name = sName & iCtr
'Sheets(SH.Name).Select
'Cells.Select
Sheets(SH.Name).DisplayGridlines = False

The last line is wrong. How do you wirte this so that it works? Please help
me!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 290
Default Making worksheets

activate the correct window and then

ActiveWindow.DisplayGridlines = False

worked for me, I dont think it likes it applied to the sheet property
and not the window.

Duncan

Fabrizio wrote:

Hi. I have a makro that displays a userform that can generate a report. The
report is to be created when the user presses a button on the user form. The
report is to be shown in a new worksheet that the program creates. I want the
new worksheet to have certain settings (e.g. no gridlines). I am trying to
write code for this but I do not know how to refer to the worksheet without
using the very unconvenient code when setting one worksheet active and then
applying the changes. Code:

Private Sub worksheetMaker()
Dim WB As Workbook
Dim SH As Worksheet
Dim iCtr As Long
Const sName As String = "Rapport "
Set WB = ActiveWorkbook
iCtr = WB.Worksheets.Count
Set SH = Worksheets.Add(after:=Worksheets(iCtr))
SH.Name = sName & iCtr
'Sheets(SH.Name).Select
'Cells.Select
Sheets(SH.Name).DisplayGridlines = False

The last line is wrong. How do you wirte this so that it works? Please help
me!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 290
Default Making worksheets

or if you know the name or index of the window you have created then
you can do

Windows (Index).DisplayGridlines = False

which should also work and then you dont need to activate.

Duncan


Duncan wrote:

activate the correct window and then

ActiveWindow.DisplayGridlines = False

worked for me, I dont think it likes it applied to the sheet property
and not the window.

Duncan

Fabrizio wrote:

Hi. I have a makro that displays a userform that can generate a report. The
report is to be created when the user presses a button on the user form. The
report is to be shown in a new worksheet that the program creates. I want the
new worksheet to have certain settings (e.g. no gridlines). I am trying to
write code for this but I do not know how to refer to the worksheet without
using the very unconvenient code when setting one worksheet active and then
applying the changes. Code:

Private Sub worksheetMaker()
Dim WB As Workbook
Dim SH As Worksheet
Dim iCtr As Long
Const sName As String = "Rapport "
Set WB = ActiveWorkbook
iCtr = WB.Worksheets.Count
Set SH = Worksheets.Add(after:=Worksheets(iCtr))
SH.Name = sName & iCtr
'Sheets(SH.Name).Select
'Cells.Select
Sheets(SH.Name).DisplayGridlines = False

The last line is wrong. How do you wirte this so that it works? Please help
me!


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
Making 1 Pivot chart from 3 different worksheets. spudsnruf Excel Discussion (Misc queries) 4 September 3rd 09 03:00 AM
Making changes automatically on multiple worksheets aaorbin Excel Discussion (Misc queries) 2 February 24th 09 05:11 PM
making new worksheets april27 Excel Programming 1 June 19th 06 04:00 PM
Programatically making worksheets dorre Excel Programming 1 February 5th 06 03:02 PM
Macro for making worksheets visible. LDanix Excel Programming 7 October 29th 04 11:32 AM


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