ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Name each Worksheet with a name? (https://www.excelbanter.com/excel-programming/364833-name-each-worksheet-name.html)

Stokh

Name each Worksheet with a name?
 
I have looked high and dry for this information and cant seem to find what I
am needing to do. I have tried it everywhich way and cant seem to get
anything to work, so any help would be GREATLY appreciated! Thank you in
advance!

I have some VB code that I need to write in C# to allow me to name each
tab(sheet) in an excel workbook, everything I try isnt working right.

Private Sub SetupWorksheet()
Dim count As Integer
For count = 1 To ThisWorkbook.Sheets.Count
ThisWorkbook.Sheets(count).Name = "Temp " & count
Next

ThisWorkbook.Sheets(1).Name = "ALL SUMMARY"
ThisWorkbook.Sheets(2).Name = "Preferred"
ThisWorkbook.Sheets(3).Name = "Standard"

Ardus Petus

Name each Worksheet with a name?
 
Your code is syntactically correct.

I don't undersand why you name your sheets "temp x" just before you name
them something else.

HTH
--
AP

"Stokh" a écrit dans le message de news:
...
I have looked high and dry for this information and cant seem to find what
I
am needing to do. I have tried it everywhich way and cant seem to get
anything to work, so any help would be GREATLY appreciated! Thank you in
advance!

I have some VB code that I need to write in C# to allow me to name each
tab(sheet) in an excel workbook, everything I try isnt working right.

Private Sub SetupWorksheet()
Dim count As Integer
For count = 1 To ThisWorkbook.Sheets.Count
ThisWorkbook.Sheets(count).Name = "Temp " & count
Next

ThisWorkbook.Sheets(1).Name = "ALL SUMMARY"
ThisWorkbook.Sheets(2).Name = "Preferred"
ThisWorkbook.Sheets(3).Name = "Standard"




Stokh

Name each Worksheet with a name?
 
I need to write in a C# OFFICE PROJECT so this code wont work in codebehind
page of ThisWorkBook.cs page

I am looking for the C# conversion of the listed code.

"Ardus Petus" wrote:

Your code is syntactically correct.

I don't undersand why you name your sheets "temp x" just before you name
them something else.

HTH
--
AP

"Stokh" a écrit dans le message de news:
...
I have looked high and dry for this information and cant seem to find what
I
am needing to do. I have tried it everywhich way and cant seem to get
anything to work, so any help would be GREATLY appreciated! Thank you in
advance!

I have some VB code that I need to write in C# to allow me to name each
tab(sheet) in an excel workbook, everything I try isnt working right.

Private Sub SetupWorksheet()
Dim count As Integer
For count = 1 To ThisWorkbook.Sheets.Count
ThisWorkbook.Sheets(count).Name = "Temp " & count
Next

ThisWorkbook.Sheets(1).Name = "ALL SUMMARY"
ThisWorkbook.Sheets(2).Name = "Preferred"
ThisWorkbook.Sheets(3).Name = "Standard"






All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com