Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #108296

Re: Worksheets dilemma

From Claus Busch <claus_busch@t-online.de>
Newsgroups microsoft.public.excel.programming
Subject Re: Worksheets dilemma
Date 2015-12-09 16:22 +0100
Organization A noiseless patient Spider
Message-ID <n49gra$qmu$1@dont-email.me> (permalink)
References <0c8b6dfc-51f6-40f7-bc56-894fc63bb603@googlegroups.com>

Show all headers | View raw


Hi Steve,

Am Wed, 9 Dec 2015 06:58:52 -0800 (PST) schrieb Steven@pctamers.eu:

> I have a workbook that is a Field Report. It starts with one visible sheet and when the user changes a certain cell to a particular piece of text a "new" sheet is "created" - in reality it is simply an existing sheet which is unhidden by the code. This "new" sheet is called "OEM". The workbook has lots of VBA code for Workbook_BeforeSave which checks that some mandatory cells have been completed on OEM and other sheets. All is working well. But . . . It may be that the user wants to create another OEM sheet. I've achieved this by copying the orinal OEM sheet, so we have OEM and OEM(1). All good so far, except of course the VBA code does not work for the new sheet "OEM(1)"
> 
> I hope that's explained clearly enough. So my question is, what is the best way to get around this i.e. get some VBA code to run on OEM(1)?  I realise I could create more code for potential new sheets but am hoping there is a more elegant way?

try in Workbook_BeforeSave

For Each wsh In Worksheets   
    If Left(wsh.Name, 3) = "OEM" Then
        your code


Regards
Claus B.
-- 
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Worksheets dilemma Steven@pctamers.eu - 2015-12-09 06:58 -0800
  Re: Worksheets dilemma Claus Busch <claus_busch@t-online.de> - 2015-12-09 16:22 +0100
    Re: Worksheets dilemma Steven@pctamers.eu - 2015-12-11 00:31 -0800
      Re: Worksheets dilemma Claus Busch <claus_busch@t-online.de> - 2015-12-11 09:42 +0100
        Re: Worksheets dilemma Steven@pctamers.eu - 2015-12-11 08:57 -0800
        Re: Worksheets dilemma Steven@pctamers.eu - 2015-12-14 03:42 -0800
          Re: Worksheets dilemma Claus Busch <claus_busch@t-online.de> - 2015-12-14 12:51 +0100
  Re: Worksheets dilemma Steven@pctamers.eu - 2015-12-14 08:31 -0800

csiph-web