座右铭: 只做有益人类的事 不做有害人类的事
|
|
A Form used to Pick Up from a Worksheet
Zhanshan Dong
Excel provides a handy control called RedEdit. If you put a RefEdit control
on a modal form, you can easily pick up a range of cells in a worksheet. This
is pretty useful when you design a complicated form to achieve a advanced function.
But if you want the complicated form to be modalless, you can not use RefEdit
control in the form. Otherwise you will crash Excel and freeze it. Such a disaster!
But we can still use this hand control. The idea is create a very simple form
in which only a few controls or just one RefEdit control are put. You can use
this form to pick up data and transfer the data to the main form. Please download
the simple form and VBA code by use the link at the bottom of this page. The
procedure used to accept and digest the data is listed as below. To use the downloaded files, just unzip the file and import the form files in VBA editor.
dim myrange as range
dim VarInCol as boolean
Me.Hide
frmAddVariables.Show
If frmAddVariables.redVariable.Value <> "" Then
Set myrange = Range(frmAddVariables.redVariable.Value)
VarInCol = frmAddVariables.rbtnCol.Value
End If
frmAddVariables.Hide
Me.Show
|
Download source code
|
|