View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Prevent UserForm on top of a worksheet from being dragged around screen

Larry,

a quick scan of your code..



.....


'Note: the form is currently shown..
'IF you have already SET the rowsource of SelectComponent THEN
'you'll be working and clearing in the rowsource of the control....


'That is slow.. may block cells, and trigger events on the form.
'So before working on a rowsource range be sure to "FREE" the range.


Me.lstSelectComponent.RowSource = vbNullString
Call FilterComponent_Rgn(g_strCellEqpSel, intRegionCode)
Me.lstSelectComponent.RowSource = _
ThisWorkbook.Range("result_prod_rgn_nonnull").Addr ess(external:
=True)



End Sub


Sub FilterComponent_List(ProdType As String, RegionCode As Integer)

'AVOID THE USE OF WINDOWS.. USE WORKBOOKS INSTEAD
'Windows(strBookSource) will not work if you have 2 windows for that
book open.

'you could set a worksheet variable..
'Dim ws As Worksheet
'Set ws = Workbooks(strBookSource).Worksheets(strSheetSource )
'then EITHER use
'ws.Range

'or With/end with

'With ws

'OR you could do it in 1 line..


With Workbooks(strBookSource).Worksheets(strSheetSource )

'within a WITH you need the DOT to "tunnel"
'populate ProductType and RegionCode cells in Sheet B

.Range(strRangeCriteriaProdType).Value = ProdType
.Range(strRangeCriteriaRgnCode).Value = RegionCode

.Range(strRangeExtract).ClearContents

.Range(strRangeData).AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range(strRangeCriteria), _
CopyToRange:=Range(strRangeExtractTop), _
Unique:=True

'... code to strip blank values in Sheet B's extract range and
' put non-null values into Sheet B's range
"result_prod_rgn_nonnull"

End With


End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"L Mehl" wrote:

Me.lstSelectComponent.RowSource = "result_prod_rgn_nonnull"