Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Listbox and sheet updating issue

I need your assistance with a problem I have with a listbox.
I have a sheet containing a range "Reporting_Periods" which has col(1) = a
number 1 to 15 (Period), and Col(2) a StartDate and col(3) an EndDate.
I have a userform with one listbox, and 3 textboxes - Period, Startdate,
Enddate. The users may change the dates in an existing Period, and if the
click in the blank line under the last populated row in the listbox, they
can create a new Period.
The listbox is populated at Userform_Initialize which sets the row source
and the bound column (Period).
Everything works OK for editing existing entries and creating the first new
Period.
When the user tries to create another new Period by clicking on the blank
line under the new period just entered an error 1004 is raised indicating
that the select method failed. Here is the code I use to update the sheet:

Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 0).Select
Selection = intPeriod
Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 1).Select
Selection = dteSDate
Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 2).Select
Selection = dteEdate
Selection.Value = txtEdate.Value
Call Update_ProjectInformation

At form_Initalize event I activate and unprotect the sheet. I protect the
sheet on Query_close event.

However, it seems as if something is re-protecting the sheet and it is not
in my code. If I run Debug when the error occurs and enter a sheet.unprotect
above the error line then move the run pointer to the sheet.unprotect, the
code executes.

Does anyone have an idea as to what may be causing this problem? Or, is
there a better way to update the form?

Thank you for your advice.

Rick

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default Listbox and sheet updating issue

nothing in your code protect sheet so if it happening it have to be
somewhere else. but why you select cell just to put something in it? that
what newbees do. you can just do

Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 0).Value =
intPeriod

but if sheet protect that fail to.

"news.microsoft.com" wrote in message
...
|I need your assistance with a problem I have with a listbox.
| I have a sheet containing a range "Reporting_Periods" which has col(1) = a
| number 1 to 15 (Period), and Col(2) a StartDate and col(3) an EndDate.
| I have a userform with one listbox, and 3 textboxes - Period, Startdate,
| Enddate. The users may change the dates in an existing Period, and if the
| click in the blank line under the last populated row in the listbox, they
| can create a new Period.
| The listbox is populated at Userform_Initialize which sets the row source
| and the bound column (Period).
| Everything works OK for editing existing entries and creating the first
new
| Period.
| When the user tries to create another new Period by clicking on the blank
| line under the new period just entered an error 1004 is raised indicating
| that the select method failed. Here is the code I use to update the sheet:
|
| Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 0).Select
| Selection = intPeriod
| Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 1).Select
| Selection = dteSDate
| Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 2).Select
| Selection = dteEdate
| Selection.Value = txtEdate.Value
| Call Update_ProjectInformation
|
| At form_Initalize event I activate and unprotect the sheet. I protect the
| sheet on Query_close event.
|
| However, it seems as if something is re-protecting the sheet and it is not
| in my code. If I run Debug when the error occurs and enter a
sheet.unprotect
| above the error line then move the run pointer to the sheet.unprotect, the
| code executes.
|
| Does anyone have an idea as to what may be causing this problem? Or, is
| there a better way to update the form?
|
| Thank you for your advice.
|
| Rick
|

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Listbox and sheet updating issue

Thank you Homey. Your suggested change worked.
It wasn't a sheet protection problem after all - just a cell selection
problem.

"Homey" <none wrote in message
...
nothing in your code protect sheet so if it happening it have to be
somewhere else. but why you select cell just to put something in it?
that
what newbees do. you can just do

Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex, 0).Value =
intPeriod

but if sheet protect that fail to.

"news.microsoft.com" wrote in message
...
|I need your assistance with a problem I have with a listbox.
| I have a sheet containing a range "Reporting_Periods" which has col(1) =
a
| number 1 to 15 (Period), and Col(2) a StartDate and col(3) an EndDate.
| I have a userform with one listbox, and 3 textboxes - Period, Startdate,
| Enddate. The users may change the dates in an existing Period, and if
the
| click in the blank line under the last populated row in the listbox,
they
| can create a new Period.
| The listbox is populated at Userform_Initialize which sets the row
source
| and the bound column (Period).
| Everything works OK for editing existing entries and creating the first
new
| Period.
| When the user tries to create another new Period by clicking on the
blank
| line under the new period just entered an error 1004 is raised
indicating
| that the select method failed. Here is the code I use to update the
sheet:
|
| Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex,
0).Select
| Selection = intPeriod
| Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex,
1).Select
| Selection = dteSDate
| Range("Project_Reporting_Dates_Top").Offset(ListBo x1.ListIndex,
2).Select
| Selection = dteEdate
| Selection.Value = txtEdate.Value
| Call Update_ProjectInformation
|
| At form_Initalize event I activate and unprotect the sheet. I protect
the
| sheet on Query_close event.
|
| However, it seems as if something is re-protecting the sheet and it is
not
| in my code. If I run Debug when the error occurs and enter a
sheet.unprotect
| above the error line then move the run pointer to the sheet.unprotect,
the
| code executes.
|
| Does anyone have an idea as to what may be causing this problem? Or, is
| there a better way to update the form?
|
| Thank you for your advice.
|
| Rick
|


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
ListBox issue Luke Excel Programming 0 December 7th 09 08:02 PM
listbox issue [email protected] Excel Programming 4 March 14th 07 09:45 AM
Updating Issue Gordon[_2_] Excel Programming 3 August 14th 06 10:58 AM
listbox not updating [email protected] Excel Programming 1 May 16th 05 09:06 PM
Issue updating XLS using ADO onedaywhen Excel Programming 0 September 3rd 03 12:09 PM


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