LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Help Required

Patrick,

Error Handling changes as you recommended, but no error shown on opening
workbook. Request fro Venue input given but no data entered into cell on OK,
Request for Date input box given. Both Venue and Date shown in respective
Cells on OK (?)

No typo - double checked spelling and any spaces before and after.

I've removed the DoEvents. No change.

The code (with, as shown, or without DoEvents

Worksheets("Gross Stableford").Range("B2") = InputBox("Please Enter Venue")
DoEvents
Worksheets("Gross Stableford").Range("B4") = InputBox("Please Enter Date")

Works perfectly if assigned to a button on my toolbar (useful if I mispell)
but not when opening the workbook. ????





"Patrick Molloy" wrote:

one issue is that you're using
ON ERROR RESUME NEXT
this is hiding any issues.
so, in the workbook_open event handler,
add
ON ERROR GOTO 0
just before
ThisWorkbook.Activate

I suspect that there may be a typo in your worksheet name 'Gross Stableford' ?
If the value can't be saved, it would raise an error - by switchign off the
trapping, you'll see it now.
Expect error #1004 if the range can't be found

you don't need DOEVENTS if this was the issue

Q2. what is your PCs local date setting? you're inputting a UK date style,
but maybe your input box is convertign to a US date. You haven't told us what
actually gets put into the cell on the sheet.










"barrowhill" wrote:

Rick,

Some more explanation to previous post............

With VBE open the "This Workbook" object in project window contains the code
........

Worksheets("Sheet2").Range("A1") = InputBox("Please enter the venue")
DoEvents
Worksheets("Sheet2").Range("A2") = InputBox("Please enter the date")

.............in Private Sub Workbook_Open() procedure

I created "Module1" and copied the same procedure to this

I also created another procedure in Module1 with only the code specified
above. a new tool bar button was created -'Input Venue & Date' and (macro)
assigned to this procedure.

Spreadsheet saved thinking all bases covered.

Opening; input message box appears. Type in venue and OK. Venue name does
not appear in cell. Next message box appears. Type in date and OK. Venue
and date appear in respective cells.

Clear cells contents

Click newly created button. Input message box appears. Type in venue and
OK. Venue name appears in cell. Next message box appears. Type in date and
OK. date appears in cell.

Same code in "This Workbook" object, Module1 and assigned to toolbar button.
Only works with button ?

My actual code is..............

Private Sub Workbook_Open()
'
On Error Resume Next
Application.ScreenUpdating = False
'
Workbooks("Book1").Close
ThisWorkbook.Activate
'
' Remove unnecessary Tool Bars on Opening
'
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Standard").Visible = False
'
Application.CommandBars("BUGSModifiedStableford"). Visible = True
'
Worksheets("Gross Stableford").Range("B2") = InputBox("Please Enter
Venue")
DoEvents
Worksheets("Gross Stableford").Range("B4") = InputBox("Please Enter Date")

End Sub



"Rick Rothstein" wrote:

Put a DoEvents statement after the first quesion. For example...

Worksheets("Sheet2").Range("A1") = InputBox("Please enter the venue")
DoEvents
Worksheets("Sheet2").Range("A2") = InputBox("Please enter the date")

--
Rick (MVP - Excel)


"barrowhill" wrote in message
...
Rick,

Thanks for your continued help...............

Found the problem - me. In copying code I put in wrong place !!. Dumbo.

Now working OK. Perhaps you can help on related matter. Having put code
line in for input of venue, I've followed this immediately with another
code
line for input of date.

I note the following......

1. Having input venue this is not input to cell on clicking OK. It's
immediatly followed by input box for date. Input date and click OK, both
appear in respective cells no problem.

What do I need to add to see venue in cell before being asked for date?

2. Cell format for date is eg. '19 September 2009'. I input as
'19/09/09'
expecting converstion as if I typed directly. Do I have to use correct
format on input using input box method?










"Rick Rothstein" wrote:

Do you perhaps have your security settings set to not run macros?

--
Rick (MVP - Excel)


"barrowhill" wrote in message
...
Rickm

Should of said I was using Excel 2003.

In answer to your question, No and Yes !. I've added the main code
line
with obviously changed parameters to and existing procedure.

On opening I don't get the input box requesting my text/date. Hence
Answer
No.

If I run in debug mode and run to curser where curser is set after 'End
Sub'
it works. Hence answer Yes.

Perplexed!?!

"Rick Rothstein" wrote:

Sorry, I posted this to your message by mistake.

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in
message
...
Except for the the cell being assigned to (you didn't tells us that
in
your first posting, but you should be able to change that on your
own)
and
the fact that only one question was asked (you should be able to add
the
second question easy enough by just duplication the first one), what
about
Patrick's solution didn't work for you?

--
Rick (MVP - Excel)


"Patrick Molloy" wrote in
message ...
in the development environment (ALT+F11)
from the Project Explorer, right click the ThisWorkbook object and
select
View Code
- in fact double clicking it opens its code window.
select 'Workbook' in th eobject list
Excel adds the _Open event

add the code and edit it appropriately


Private Sub Workbook_Open()
Worksheets("Sheet2").Range("A1") = InputBox("Please enter the
date")
End Sub

"barrowhill" wrote:

I have a spreadsheet that on opening for first time requires the
input
of
text (a venue) in one cell and the Date in another.

On opening, I'd like to be prompted to input the venue then
prompted
to
input the date.

Appreciate help.







 
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
Help required .... [email protected] Excel Worksheet Functions 2 December 22nd 08 06:31 PM
VBA Help required...................! Thyagaraj Excel Programming 4 July 20th 06 02:42 PM
VBA Help required..........! Thyagaraj Excel Programming 1 July 1st 06 11:06 AM
Bit of help required. PaulOakley[_7_] Excel Programming 2 July 18th 05 07:20 PM
New to VBA - help required please. Neil Grantham Excel Programming 3 September 30th 03 01:56 PM


All times are GMT +1. The time now is 07:28 AM.

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"