Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Microsoft Office support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Microsoft Office support MS Office support forum

Reply
 
LinkBack Thread Tools
Old 05-24-2005, 08:30 AM   #1 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Excel advance help! Interesting problem.

Attaced is a sample of what I want to do.

I want an inventory sheet that I can select how many items I want, the formula selects that cheapest vendors price and then the items are sent to the ordering form per vendor.

The Problem!

I want the order form not to show blank lines. I want the items to drop in without these spaces.

can anyone help?

can excel files be uploaded? I cannot seem to upload it!

Last edited by 00Seven; 05-24-2005 at 08:39 AM.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 05-24-2005, 08:32 AM   #2 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


To see file, goto:

http://forums.techguy.org/t365104.html

Last edited by 00Seven; 05-24-2005 at 08:43 AM.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-24-2005, 08:58 AM   #3 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

I would have thought that instead of using a vlookup you would be better having a macro assigned to a button which reads in the values into two separate arrays which sort the data items into vendor 1 and vendor 2, then populating the order forms with the arrays.

I'll take a bit of a closer look at this to see if I can give you some more specific advice.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-24-2005, 09:22 AM   #4 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


oooh! You lost me there.

I am good at excel, but that was back in 1995. I am not sure about this new advanced methods.

Could you explain a little more in detail?

Thanks
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-24-2005, 09:42 AM   #5 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

OK, it involves using VBA behind excel to 'automate' tasks. You click on a button and it goes off and runs a load of VB code. In this case, it would go through the list and if it comes to one where Vendor1 is cheaper, it adds the details to the Vendor1 array, likewise Vendor2. When it's finished, it dumps the details from each into the other sheets which can then be printed off and sent.

What version of excel are you running?

I'm going to have a look at the code you need after work tonight, and I'll see if I can put together a little sample code for you to use.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-24-2005, 10:08 AM   #6 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


That would be awesome. Thanks.

Version 2000.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-24-2005, 10:08 AM   #7 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Sorry.....try this again.

MS Office 2003
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 04:58 AM   #8 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

OK, got a version here which appears to work. There are a few more sheets now... the right-most three will need to have their details updated with the right values - prices for the two vendors and their ordercodes.

To use, simply enter how many of each item you want in the grey section of the Inventory sheet, then click the "Generate Forms" button at the top of the sheet. It should take less than a second.

Also, if you add new vendors/items, then you will need to play around with the code a little.

It's a little sloppy in it's execution, but it does work.

File is uploaded as a .txt attachment - rename to .xls and open.

Hope this helps! If you have any questions about it, let me know and I'll do my best to answer them.
Attached Files
File Type: txt Testing Inventory.txt (189.5 KB, 5 views)
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."

Last edited by ReeKorl; 05-25-2005 at 04:59 AM. Reason: Would help if I attached the file....
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 07:03 AM   #9 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Thanks!.

I changed it to .xls.

I put some figures in to test it, but the generate button only shows me the move arrows and does not press.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 07:13 AM   #10 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

hmm... ok. I think you're still in edit mode for it. Don't know why it defaulted to that, but here's the solution.

Right click on the toolbars at the top and make sure Control Toolbox is checked. Then click on the icon at the far left of the control toolbox (picture attached)

It should work then.

First pic is the button ringed. Second is how it should look. Third is how it should NOT look.
Attached Images
File Type: png editbutton.png (1.8 KB, 2 views)
File Type: png editbuttongood.png (1.4 KB, 1 views)
File Type: png editbuttonbad.png (1.5 KB, 1 views)
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 07:13 AM   #11 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Think I got it, the macros was not running......I will play with it today.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 07:36 AM   #12 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


ok...now how do I edit the code so when I change the vendor names to real names and add a vendor?
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 08:38 AM   #13 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

This is going to be quite a long post, so brace yourself.

If you go to Tools->Macro->Visual Basic Editor, it should bring up the VBA window. See image attached for layout.

To add another vendor, you will need to do a few things. It's probably best to keep the sheet names generic and just changing the details in the sheets, rather than customising the sheet names also. First of all, replicate the Vendor1OrderForm and Vendor1Prices sheets as Vendor3*** and make sure they are the same as the others in terms of where the formulae are pointing and the EXACT layout, ie same cells for the headings, etc. When copying Orderform sheet, don't forget to copy across the details in column A - they're coloured white so as to be invisible to a printer, but they are used.

Next, add a third column to ordercodes for the third vendor.

Next, a third column in Inventory for the third vendor's prices - don't forget to change the calc for the lowest price in column G.

Finally, the code. In VBAProject (Testing Inventory.xls) on the top left of the VBA window you opened up a little earlier, open it and open up the Modules folder and double click on Module1. This will bring up the module code on the right.

ok, the additional lines will be shown in blue in the following code (green text is commented text):

Code:
'Initial setup
'Dimension Variables
Dim WsData As Worksheet
Dim Ws1 As Worksheet
Dim Ws2 As Worksheet
Dim Ws3 As Worksheet
Dim DataArray(162, 3)
Dim V1Array(162, 2)
Dim V2Array(162, 2)
Dim V3Array(162, 2)
Dim V1Pointer As Integer
Dim V2Pointer As Integer
Dim V3Pointer As Integer
Dim Column As Integer
Dim Row As Integer
'Define Variables
Set WsData = ThisWorkbook.Worksheets("Inventory")
Set Ws1 = ThisWorkbook.Worksheets("Vendor1OrderForm")
Set Ws2 = ThisWorkbook.Worksheets("Vendor2OrderForm")
Set Ws3 = ThisWorkbook.Worksheets("Vendor3OrderForm")
V1Pointer = 0
V2Pointer = 0
V3Pointer = 0
Column = 1
Row = 1
Code section 1:

Code:
...Ws2.Cells(Row + 12, 4).Value = ""
    Row = Row + 1
Loop Until Row = 44
Row = 1
Do
    Ws3.Cells(Row + 12, 1).Value = ""
    Ws3.Cells(Row + 12, 3).Value = ""
    Ws3.Cells(Row + 12, 4).Value = ""
    Row = Row + 1
Loop Until Row = 44
Row = 1
Applic...
Note the Ws3.Cells instead of Ws2.Cells

Code Section 2:

Code:
ElseIf DataArray(Row - 1, 3) = "Vendor 2" Then
V2Array(V2Pointer, 0) = DataArray(Row - 1, 0)
V2Array(V2Pointer, 1) = DataArray(Row - 1, 1)
V2Array(V2Pointer, 2) = DataArray(Row - 1, 2)
V2Pointer = V2Pointer + 1
ElseIf DataArray(Row - 1, 3) = "Vendor 3"  Then
V3Array(V3Pointer, 0) = DataArray(Row - 1, 0)
V3Array(V3Pointer, 1) = DataArray(Row - 1, 1)
V3Array(V3Pointer, 2) = DataArray(Row - 1, 2)
V3Pointer = V3Pointer + 1
Else
Code Section 3:

Code:
Do
Ws2.Cells(Row + 12, 1).Value = V2Array(Row - 1, 0)
Ws2.Cells(Row + 12, 3).Value = V2Array(Row - 1, 1)
Ws2.Cells(Row + 12, 4).Value = V2Array(Row - 1, 2)
Row = Row + 1
Loop Until Row = V2Pointer + 1
Row = 1
Do
Ws3.Cells(Row + 12, 1).Value = V3Array(Row - 1, 0)
Ws3.Cells(Row + 12, 3).Value = V3Array(Row - 1, 1)
Ws3.Cells(Row + 12, 4).Value = V3Array(Row - 1, 2)
Row = Row + 1
Loop Until Row = V3Pointer + 1
'
'Code Sec...
Code Section 4:

Code:
Set Ws2 = Nothing
Set Ws3 = Nothing
Application.CalculateFullRebuild
Hope this makes sense!
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."

Last edited by ReeKorl; 05-25-2005 at 08:41 AM.
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 09:00 AM   #14 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


I am looking throught it now.

You could not be more clear. I will try this now.

Thanks so much.

Last edited by 00Seven; 05-25-2005 at 09:03 AM.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-25-2005, 09:51 AM   #15 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Would you mind having a look at this, I seem to have a run error.
Attached Files
File Type: txt Testing Inventory3vendors.txt (224.0 KB, 2 views)
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-26-2005, 01:45 AM   #16 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

Got it.

I forgot to put in any checking to see if there were no vendors - the following changes need to be made to code section 3:

Code:
If V1Pointer = 0 Then

Else
Do
    Ws1.Cells(Row + 12, 1).Value = V1Array(Row - 1, 0)
    Ws1.Cells(Row + 12, 3).Value = V1Array(Row - 1, 1)
    Ws1.Cells(Row + 12, 4).Value = V1Array(Row - 1, 2)
    Row = Row + 1
Loop Until Row = V1Pointer + 1
Row = 1
End If
If V2Pointer = 0 Then

Else
Do
    Ws2.Cells(Row + 12, 1).Value = V2Array(Row - 1, 0)
    Ws2.Cells(Row + 12, 3).Value = V2Array(Row - 1, 1)
    Ws2.Cells(Row + 12, 4).Value = V2Array(Row - 1, 2)
    Row = Row + 1
Loop Until Row = V2Pointer + 1
Row = 1
End If
If V3Pointer = 0 Then

Else
Do
    Ws3.Cells(Row + 12, 1).Value = V3Array(Row - 1, 0)
    Ws3.Cells(Row + 12, 3).Value = V3Array(Row - 1, 1)
    Ws3.Cells(Row + 12, 4).Value = V3Array(Row - 1, 2)
    Row = Row + 1
Loop Until Row = V3Pointer + 1
End If
Also, because you've added a new column into the Inventory worksheet, you'll need to change this:

Code:
    If Column = 7 Then
        Do
            DataArray(Row - 1, Column - 4) = WsData.Cells(Row + 8, Column + 2).Value
            Row = Row + 1
        Loop Until Row = 164
    Else
Oh, and don't forget to make column A's text white on OrderForm3.

Hope this helps!
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-26-2005, 06:30 AM   #17 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


ReeKorl! YOU are genius! Thank you, thak you.

Now....how do I start to learn some basic Visual Basic for Excel? And where should I go to look?

S
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-26-2005, 07:52 AM   #18 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

Not a genius, just glad to have helped

For further learning, you can google "VBA tutorial" and there are some good sites out there (unfortunately, I can't remember any offhand, sorry), but I would recommend getting [url=http://www.amazon.com/exec/obidos/ASIN/0764574124//ref=nosim/connorswebguidec VBA Programming for Dummies[/url] - it's currently listed at $16.49 at amazon.com. Also, for a bit more advanced stuff, try [url=http://www.amazon.com/exec/obidos/ASIN/0764540726//ref=nosim/connorswebguidec 2003 Power Programming with VBA[/url]

The built-in help files are quite useful aswell. If you're ever bored one day, set yourself a task: pick a topic at random from the help files, then make something which uses it. You may fail at first, as the random topic might be a bit hard, but you'll get there.

Most of all, practice what you already know, and you'll find new ways of doing what you want. Keep working at it, and you'll pick other things up purely by accident!

ps, if I do find any decent VBA tutorial sites, I'll be sure to post back with the url.

-EDIT

Here's something which may help - it's a list of all of the websites maintained by the Microsoft MVPs - take a look at the Excel section and look at some of their sites.

http://www.mvps.org/links.html#excel
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."

Last edited by ReeKorl; 05-26-2005 at 07:58 AM.
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-26-2005, 10:41 AM   #19 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Where is St. Albans in England?
I used to live in West Sussex many moons ago.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-26-2005, 02:46 PM   #20 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

About 20 miles north of London. Very short train journey.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 08:53 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85