LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA

Dear All,

In my little macro, I make entries in a worksheet, then copy this and give
it a new name. then I go back to the "template" and want to remove the
contents of some cells.

1) First I create a copy of the active worksheet
2) Then I want to remove the button from the new worksheet. Currently I only
set it invisible. How can I remove it?
3) After creating the new worksheet I activate the original one again. No I
want to delete the contents (simple text) of a set of cells. How can I do
that. Currently I try by doing "ActiveSheet.Cells("C3").Text = "test"". But
that creates an error.

Moreover, I'm interested in how I check the name of the new worksheet, i.e.
to avoid that the same name exists already. Also interesting is to check
whether only valif characters will be used for the new name. This will be
defined by the user. Is there a validation function?

Many thanks in advance for your help,
Patrick

My code is as follows:

'Ablegen der Eingaben als neues Worksheet
Public Function CopyZufriedenheitsCheck()
'Variablen
Dim wsName As String
Dim MyTime
MyTime = Time

'Kopieren des Worksheets
ActiveSheet.Range("KdNr").Select
wsName = "RufNr. " & ActiveSheet.Range("C4").Text & "_" &
ActiveSheet.Range("I3").Text
Worksheets("Template Zufriedenheitscheck").Copy
After:=Worksheets("Template Zufriedenheitscheck")

ActiveSheet.Name = wsName

'Hinweis für den Benutzer
MsgBox "Ein neues Arbeitsblatt wurde erstellt. Der Name lautet: " &
ActiveSheet.Name

'Entfernen des Buttons auf dem neuen Blatt
ActiveSheet.OLEObjects.Visible = False

'Zurückspringen auf das Template
Worksheets(2).Activate

'Zurücksetzen der Werte
ActiveSheet.Cells("C3").Text = "test"
ActiveSheet.Range("C4").Text = ""
ActiveSheet.Range("C5").Text = ""
ActiveSheet.Range("I3").Text = ""

End Function
 
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



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