B
BJ&theBear
I am currently trying to construct an idiot proof spreadsheet which is
almost complete
However the latest problem stems from the use of a userform with about
15 criteria on it to select the relevant information and copy it to a
newly created spreadsheet with just the selected criteria. This new
cpreadsheet will be used for printed reports
I have a basic knowledge of VBA but am encountering difficulties and
would appreciate some advice/help
a) The first selection Userform option button criteria is called
"optallprojects" - if this is true then I want all project IDs
selected from column 1 in the main sheet called "hoursworked"
b) The second selection option button criteria is called
"optspecificprojectno" and if this is true then I want the value in
the next box "lstselectprojectno" to become the selection criteria in
Column 1
I then want to use the values from a or b to autofilter the
spreadsheet and give me the relevant selection which can then be
copied over to a newly created spreadsheet/
I think it should be along the lines of
Private Sub createnewspreadsheet ()
'selection process only
If optallprojects.value = true
then selection.autofilter field :=1
else
selection.autofilter field:= 1 criteria1:= lstselectprojectno.value
'Once the selection is made how do you copy the filtered records to a
newly created spreadsheet when you have no idea how many records will
be part of the filter?
end sub
I am experiencing difficulties mainly because I have not done a great
deal of VBA programming in recent years. Once I have got my head
round this selection and option process then I hope I can program the
rest of the options.
Can anyone help in getting this to work
Any help or advice would be appreciated
Brian
Scotland
almost complete
However the latest problem stems from the use of a userform with about
15 criteria on it to select the relevant information and copy it to a
newly created spreadsheet with just the selected criteria. This new
cpreadsheet will be used for printed reports
I have a basic knowledge of VBA but am encountering difficulties and
would appreciate some advice/help
a) The first selection Userform option button criteria is called
"optallprojects" - if this is true then I want all project IDs
selected from column 1 in the main sheet called "hoursworked"
b) The second selection option button criteria is called
"optspecificprojectno" and if this is true then I want the value in
the next box "lstselectprojectno" to become the selection criteria in
Column 1
I then want to use the values from a or b to autofilter the
spreadsheet and give me the relevant selection which can then be
copied over to a newly created spreadsheet/
I think it should be along the lines of
Private Sub createnewspreadsheet ()
'selection process only
If optallprojects.value = true
then selection.autofilter field :=1
else
selection.autofilter field:= 1 criteria1:= lstselectprojectno.value
'Once the selection is made how do you copy the filtered records to a
newly created spreadsheet when you have no idea how many records will
be part of the filter?
end sub
I am experiencing difficulties mainly because I have not done a great
deal of VBA programming in recent years. Once I have got my head
round this selection and option process then I hope I can program the
rest of the options.
Can anyone help in getting this to work
Any help or advice would be appreciated
Brian
Scotland