Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Userform Code

Here is my code:

Private Sub cmbxPeriod_Change()
Sheets("CEU Database").Unprotect Password:="dataworf"
Sheets("Code").Range("P2").Value = usfReset.cmbxPeriod.Value
Application.ScreenUpdating = False
Sheets("CEU Database").Select
Cells.Select
Selection.AutoFilter Field:=7, Criteria1:=Sheets("Code").Range("P2").Value
Application.ScreenUpdating = True
Sheets("CEU Database").Protect Password:="dataworf",
DrawingObjects:=False, Contents:=True, Scenarios:=True
End Sub

I have used a variation of this code many times in the past without problem.
However, the usfReset.cmbxPeriod.Value is a date. One issue might be that
the cells are already filtered by one criteria.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Userform Code

Private Sub cmbxPeriod_Change()
Sheets("CEU Database").Unprotect Password:="dataworf"
Sheets("Code").Range("P2").Value = clng(usfReset.cmbxPeriod.Value)
Sheets("Code").Range("P2").Numberformat = _
Sheets("CEU Database").Range("G2").Numberformat
Application.ScreenUpdating = False
Sheets("CEU Database").Select
Cells.Select
Selection.AutoFilter Field:=7,
Criteria1:=Sheets("Code").Range("P2").Text
Application.ScreenUpdating = True
Sheets("CEU Database").Protect Password:="dataworf",
DrawingObjects:=False, Contents:=True, Scenarios:=True
End Sub

Untested, but might work.

--
Regards,
Tom Ogilvy


"scrabtree23" wrote in message
...
Here is my code:

Private Sub cmbxPeriod_Change()
Sheets("CEU Database").Unprotect Password:="dataworf"
Sheets("Code").Range("P2").Value = usfReset.cmbxPeriod.Value
Application.ScreenUpdating = False
Sheets("CEU Database").Select
Cells.Select
Selection.AutoFilter Field:=7,

Criteria1:=Sheets("Code").Range("P2").Value
Application.ScreenUpdating = True
Sheets("CEU Database").Protect Password:="dataworf",
DrawingObjects:=False, Contents:=True, Scenarios:=True
End Sub

I have used a variation of this code many times in the past without

problem.
However, the usfReset.cmbxPeriod.Value is a date. One issue might be

that
the cells are already filtered by one criteria.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Userform Code

Didn't Dave Peterson solve this for you in your previous post? If not,
explain why it didn't work.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"scrabtree23" wrote in message
...
Here is my code:

Private Sub cmbxPeriod_Change()
Sheets("CEU Database").Unprotect Password:="dataworf"
Sheets("Code").Range("P2").Value = usfReset.cmbxPeriod.Value
Application.ScreenUpdating = False
Sheets("CEU Database").Select
Cells.Select
Selection.AutoFilter Field:=7,

Criteria1:=Sheets("Code").Range("P2").Value
Application.ScreenUpdating = True
Sheets("CEU Database").Protect Password:="dataworf",
DrawingObjects:=False, Contents:=True, Scenarios:=True
End Sub

I have used a variation of this code many times in the past without

problem.
However, the usfReset.cmbxPeriod.Value is a date. One issue might be

that
the cells are already filtered by one criteria.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Userform Code

After a little play...I finally got it to working. Thanks.

"Tom Ogilvy" wrote:

Private Sub cmbxPeriod_Change()
Sheets("CEU Database").Unprotect Password:="dataworf"
Sheets("Code").Range("P2").Value = clng(usfReset.cmbxPeriod.Value)
Sheets("Code").Range("P2").Numberformat = _
Sheets("CEU Database").Range("G2").Numberformat
Application.ScreenUpdating = False
Sheets("CEU Database").Select
Cells.Select
Selection.AutoFilter Field:=7,
Criteria1:=Sheets("Code").Range("P2").Text
Application.ScreenUpdating = True
Sheets("CEU Database").Protect Password:="dataworf",
DrawingObjects:=False, Contents:=True, Scenarios:=True
End Sub

Untested, but might work.

--
Regards,
Tom Ogilvy


"scrabtree23" wrote in message
...
Here is my code:

Private Sub cmbxPeriod_Change()
Sheets("CEU Database").Unprotect Password:="dataworf"
Sheets("Code").Range("P2").Value = usfReset.cmbxPeriod.Value
Application.ScreenUpdating = False
Sheets("CEU Database").Select
Cells.Select
Selection.AutoFilter Field:=7,

Criteria1:=Sheets("Code").Range("P2").Value
Application.ScreenUpdating = True
Sheets("CEU Database").Protect Password:="dataworf",
DrawingObjects:=False, Contents:=True, Scenarios:=True
End Sub

I have used a variation of this code many times in the past without

problem.
However, the usfReset.cmbxPeriod.Value is a date. One issue might be

that
the cells are already filtered by one criteria.




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
Using Userform code in a Workbook Jake8 Excel Programming 2 November 26th 04 02:21 AM
UserForm code help needed. madbloke[_12_] Excel Programming 0 September 23rd 04 01:47 PM
UserForm code help needed. madbloke[_11_] Excel Programming 1 September 23rd 04 01:08 PM
UserForm code help needed. madbloke[_9_] Excel Programming 1 September 23rd 04 10:53 AM
VBA code for Userform Martin Los Excel Programming 4 December 5th 03 03:04 PM


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