473,513 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB for Excel

2 New Member
I may be posting in the wrong area but probably someone here can help. I am writing VBA code to do the following:
IF A1 > 50 then print array C1:E1

I have this code and it works.

Sub Test()
If Range("A1") > 50 Then
ActiveSheet.PageSetup.PrintArea = "c1:e7"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
End If
Call cler_print
End Sub
Sub cler_print()
ActiveSheet.PageSetup.PrintArea = ""
End Sub

Now, I want to be able to do the same for the following:
If A10>50 then print C10:E17
If A21>50 then print C21:E30 and so on

Question: can a series of such commands be included in one code activated by one MACRO button? If so, how does one write a series of cases testing the values in a series of cells to deterine if an associated array can be printed?

I have tried to do this repeatedly and cannot find the right syntax that will trigger a series of tests.

In the end, I want to user to complete a checklist - then click a MACRO button that will print arrays of information if the values in specific cells meet the criterion >50. I want the code to 'test' the values in 6 different cells and to print, based on compliance with the criterion, 6 different arrays of information.

I'm under the gun and am stalled. People are waiting on my solution and I can't seem to move forward as I am not too familiar with VBA.

Can and will anyone HELP???

Best regards...I know you are all busy!!


Bill (please respond to bmansfield@hscdsb.on.ca)
Mar 24 '09 #1
1 1518
billofsoo
2 New Member
Sorry, I cross posted this question on the ExcelForm and Bytes: here are the links

http://www.excelforum.com/excel-prog...es-in-vba.html
http://www.mrexcel.com/forum/showthread.php?t=378477
Mar 24 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
35485
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
3
20272
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
6
12468
by: Matthew Wieder | last post by:
I have the following requirements: Build a stand-alone C# application that asks the user to click in a cell in an Excel spreadsheet, and then displays the address of that cell in the C#...
14
5733
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the...
22
15312
by: Howard Kaikow | last post by:
There's a significant problem in automating Excel from VB .NET. Reminds me of a problem I encountered almost 3 years ago that was caused by the Norton Auntie Virus Office plug-in. Can anybody...
9
2806
by: Anthony | last post by:
To me, creating Excel 2003 spreadsheets programmatically via VB.NET hasn't really changed since the days of VB6. That is, I'd do something similar to this Code: Dim ExcelApp As...
7
2415
by: Alain \Mbuna\ | last post by:
Hi everybody. In my program I have some data that is calculated after some input from the user. I have written some code that opens an Excel workbook, with 5 worksheets and the calculated data...
16
2671
by: alexia.bee | last post by:
Hi all, In some weird reason, excel instance won;t die if i remove the comment from 4 lines of setting values into struct. here is a snipcode public...
9
4519
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
0
7264
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7543
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7106
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.