View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Advice rather than an actual question.

In addition...
It appears that all of your variables in the CommandButton1_Click() sub
could be declared as Long instead of as Variant.
Also, variable "c" has not been declared... "Dim c As Excel.Range"

That probably means that you do not have "Option Explicit" at the top of
your module. The use of Option Explicit is strongly recommended.

Some newsgroup user suggestions here...
http://www.cpearson.com/excel/newposte.htm

--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"PaulW"
wrote in message
I've set up a userform, my first one. I've currently got a supervisor testing
it.
Obviously this is my first successful attempt, and i've been working with
VBA for maybe 5/6 months, so I may have done things the long way round, or
just generally wrong.

Below are the macro's in the userform. All the buttons and boxes are still
called things like "ComboBox4" or "CommandButton3" so its quite difficult to
follow. What I'm really looking at is regardless of this (I know the entire
thing works) is if you think i've gone wrong somewhere, or have say 12 lines
of code where 1 will have done.

Really just wanting advise so I can better myself and my code.

What the userform does, is when opened take everything in row 1, and put it
in 4 combo boxes. Each of these combo boxes has another combo box to the
right of it. When you select a column header from one of the boxes on the
left, the box to the right populates with all the unique references in that
column (sorted).
When the update button is hit, it copies the entire spreadsheet, puts on the
filter and selects everything that *hasn't* been selected and deletes it.
Then it adds a couple of lines at the top to work on, and counts how many
lines of data are correct. At the top of each line it also adds together all
the numbers, so if say column 3 is "Balance" you can add all the Balances
together.

-snip-