Welcome to Dream.In.Code
Become a VB Expert!

Join 137,228 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,886 people online right now. Registration is fast and FREE... Join Now!




If Then Statement

 
Reply to this topicStart new topic

If Then Statement

compo
6 Feb, 2007 - 03:47 PM
Post #1

New D.I.C Head
*

Joined: 21 Jul, 2006
Posts: 4


My Contributions
I am trying to create a document comprising two pages at the moment. The front page has three items which change by personal selection (using switch boxes). One is a number, between 8 and 160 (in 8's). Two is a colour reference (red, blue, green). Three is a quantity 100 - 1000 (in 100's). Page two of the document comprises a grid, The first column comprises the numbers 8 - 160 (in 8's ) vertically down. The first horizontal row comprises the numbers 100 - 1000 (in 100's). The colour reference RED is just the name I have given to the second sheet. (I hope to have three sheets with different names eventually).

What I need is the code to make this work.

The front page makes reference to the cells which change and the name a have called this function "PrintText".
The code "=PrintText(L16,L18,L23)" is in cell M41 where I want the answer to appear.

The code I have presently is as follows: [b](I have tried many options, the closest I have come to a result is a reference to the cell "FourB2" not actually the number in that cell!).
CODE
            
Function PrintText(Extent, Quantity, Text_C As Variant) As Variant
If Extent = "8" And Quantity = "100" And Text_C = "4" Then PrintText = "Four!B2"
ElseIf Extent = "16" And Quantity = "100" And Text_C = "'4" Then PrintText = "Four!B3"
ElseIf Extent = "24" And Quantity = "100" And Text_C = "'4" Then PrintText = "Four!B4"
ElseIf Extent = "32" And Quantity = "100" And Text_C = "'4" Then PrintText = "Four!B5"
End If
End Function
        

Any help would be very much appreciated.
thanks,
Compo
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 03:10PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month