PC Review


Reply
Thread Tools Rate Thread

Help for Printing Sheet

 
 
Ashish
Guest
Posts: n/a
 
      19th Jul 2005
Hello All Experts,
I am a newbie and I got the following macro from the newsgroup which is
suitable for me.

The problem is that it prints the same data and does not go forward.

I will explain my problem:

Workbook Name: MyWorkbook

Sheet Name: Data with Range Name: Database
Sheet Name: MyForm used to display different details from Data Sheet

Range Name MyList is a single column on Database Sheet and is having
Data Validation used with Vlookup to extract data on MyForm Sheet

MyList: combination of Alphabets and digits for eg. GND123LTTSH,
GND124LTDTP....., EGF123SVASM, EGF124LTASM......, first three alphabets
from left is for recognizing the company and next three digits is
running serial number starting from 111 onwards, last five digits is
for recognizing type of equipment.

When the value is selected in the dropdown box all relevant details are
filled up

I wish to print say all records of GND company from 123 to 140, or EGF
company from 123 to 135.

I need to select the value in dropdown box and say GND123LTTSH and then
give the command to print upto GND140LTASM

I am using OfficeXP/Excel 2003

Can somebody modify the below code or suggest another solution for me?
It would save me a lot of time.

Thanks to anyone who will help me.


Option Explicit
Sub testme()
Dim StartVal As Long
Dim EndVal As Long
Dim TempVal As Long
Dim iCtr As Long
Dim wks As Worksheet
'The below line edited to suit my case
Set wks = Worksheets("MyWorkbook")

StartVal = CLng(Application.InputBox(Prompt:="Start with", _
Default:=1, Type:=1))
If StartVal = 0 Then
Exit Sub
End If
EndVal = CLng(Application.InputBox(Prompt:="End with", _
Default:=StartVal + 1, Type:=1))
If EndVal = 0 Then
Exit Sub
End If
If EndVal < StartVal Then
TempVal = StartVal
StartVal = EndVal
EndVal = TempVal
End If
For iCtr = StartVal To EndVal

'The below line edited to suit my case
wks.Range("MyList").Value = iCtr

'Application.Calculate 'just in case

'The below line edited to suit my case
wks.Range("MyPrint").PrintOut Preview:=True
Next iCtr
End Sub

Ashish Kumar Singh

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing 2 pages per sheet, can i reduce the left non-printing mar Barrye Microsoft Word Document Management 1 27th Nov 2009 08:11 PM
How do I stop printing a document data sheet after printing Shadow Microsoft Word Document Management 1 14th Dec 2008 09:27 PM
Printing without seeing the sheet DBishop@fujikoki.com Microsoft Excel Programming 1 3rd Dec 2006 09:45 AM
Printing a sheet =?Utf-8?B?RVc=?= Microsoft Excel Programming 1 24th Oct 2006 10:38 PM
Printing Each Sheet Gary Thomson Microsoft Excel Programming 4 28th May 2004 09:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:49 AM.