View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Alex St-Pierre Alex St-Pierre is offline
external usenet poster
 
Posts: 169
Default Allow programmation in a userform

Hi!
I would like to automate a process. I have a sheet1 that contains data (one
row for each member). The first row is a standard column header. I would like
to have a tool that allow user to construct a sheet2 from sheet1 by putting
condition in a userform. The sheet2 will also contains a column header. Does
anyone have an idea ?

What I think is :
1. At all opening of the userform, I create a module that contains all
header name of the sheet1 and all header name of the sheet2. If a new column
header is added in sheet2, the information will automatically be available in
the userform.
ex:
Public Type vInputStructure
SSN As Long
LNAME As String
FNAME As string
SERVICE As variant
End Type
Public vInput As vInputStructre

Public Type vOutputStructure
SSNKEY As Long
LASTNAME As String
FIRSTNAME As string
SERV1 As Variant
End Type
Public vOutput As vOutputStructre

2. In the userform,
a) You select the field you want to change
b) You select which record to process
c) You define the value that a) will take

3. Example.

Field to Change : vOutput.SSNKEY
For: (all)
Value: vInput.SSN

Field to Change : vOutput.SERV1
For: (all)
Value: vInput.SERVICE

Field to Change : vOutput.SERV1
For: SSN=123456789
Value: vOutput.SERV1+2

more complicated
Field to Change : vOutput.SERV1
For: (vOutput.SERV110 AND vOutput.SSNKEY<123456789)
Value: vOutput.SERV1+vOutput.OTHERSERVICE

I could stock all formulas in the first column of a conditionsheet. Also,
the programmation could be done by clicking on item button like "(" "AND"
"OR" "vOutput.SERV1", etc.
Does anyone know if there's a way to do that in excel ?
Thank's a lot!
Alex
--
Alex St-Pierre