Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Selecting A Printer With Excel VB


I am developing a macro that will create an Adobe PDF file. Adobe 6.0 is installed on the machines of all persons who will use this file. The Adobe PDF printer will not be the default printer. The printer is named "Adobe PDF on Ne01:" on my machine, but has a different name on other machines (on Ne0?. I can acquire the name of the default printer using the following code:

Dim dprin as String 'set mem variable
dprin = Application.Active Printer

How can I find the name of the Adobe PDF printer when it is not the default or active printer??

Thanks for your help!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Printer Trouble: Selecting A Printer.
Hi!

Does anyone know how to fill a combo-box with all the installed printers, and the code to use them (i.e. set them as the default for my program)?

Also, how do you tell if no printer is installed.

Thanks!

Selecting The Printer
friends
tell me one thing, is there any way to select the printer before sending a document to the printer. i have done the default printer code. it works fine with all others execpt the laser ones. the print quality becomes very bad . what to now? plz help i'm going to sick of it.

Selecting Printer
Hello,
I am using Common Dialog to allow user to select from a range of printers available on the network.
The documentation says that if I have set the Flag value to cdlPDReturnDC then Common dialog hDC will contain the device context of the printer that was selected by the user.
However, as I am trying to run the program the hDC of Common Dialog after show is different from hDC value of any of the printer present in Printers collection.
All I need to do is to catch which printer user has selected.
Any help!!


thanks,

Selecting A Different Printer
I have a combo box loaded with the names of all of the printers installed on the machine that is running my program. I need to be able to programmatically change the default printer from whatever it currently is, to whatever the user clicks on in the combo box. In the combo click event I have:

If cboPrinters.ListIndex > -1 Then
Set MyPrinter = Printers(cboPrinters.ListIndex)
End If

MyPrinter is a form level variable declared as a printer object, i.e.: Private MyPrinter As Printer

I did a search through the form for other threads relating to this. That is where I got the code currently in my combo click event, however, the "Set As Default" setting does not change when I select a new printer.

How do I programmatically change the "Set As Default" from one printer to another?

Selecting A Printer
How can I select a Printer with VB6? I'm using the following code. I can print to the window defualt, but need to select different printers.


Private Sub Print_Click()
    Dim rsPrintTitleReport As ADODB.Recordset
    Dim rsPrintOrder As ADODB.Recordset
    R2KPrinter.DeviceName = "Invoice"
  
    SQL = "SELECT tblOrders from tblOrders WHERE tblOrders.OrdNbr= '177000'"
    Set rsPrintOrder = deR2K.cnR2K.Execute(SQL)
    Set rptInvoice.DataSource = rsPrintOrder
    rptInvoice.PrintReport
    
End Sub

Thanks in advance....Joe

 

Selecting Printer
Hey,

I have a form (in vb6) with a crystal viewer on it.
When the user clicks on the print button of the viewer, he cannot select the printer he wants to print to.
I think the default printer is showing up, but not sure.
Am i missing some setting?
How can this be fixed?

Thanks

Selecting Printer From Vb
Friends,

I have used vb6,crystal report 7,sql server 7 desktop edition and developed a application and running on windows 98SE m/c.

I have two printers connected to m/c.

Will anyone help me with vb code on how to set one printer out of two printers as default printer while printing reports.

cthirus

Printing And Selecting Printer
I would like to know what API calls or functions are needed in order to determine the default printer, then also determine if a certain printer exists in the printer folder, then select it for use. I would then like to have that newly selected printer start printing a file. Any help would be great. Thank you.

Selecting Printer With CommonDialog
I key in this code to allow users to select the printer:

With CommonDialog1
CommonDialog1.ShowPrinter
End With

sub_printit


Problem is the printer selected now is the default. Don't want that.

So after reading my book I do this:

With CommonDialog1
CommonDialog1.PrinterDefault = False
CommonDialog1.ShowPrinter
End With

Now it prints to the default printer regardless of the printer I selected.

So I do this:
With CommonDialog1
CommonDialog1.ShowPrinter
CommonDialog1.PrinterDefault = False
End With

And I am back to my original problem. Can anyone educate me
on what I need to do? My book does not give me any examples.

Thanks
Tom

Selecting A Printer At Runtime
Hi i need to allow the user to selct the prnter they want to use at run time ideally i would like them to just select the name and nothing else so that is why i do not wish to use the common dialog control shipped with VB

Any ideas?

PS i do not want to set the printer as the default!!

Cheers Mark

Selecting Printer For CRViewer
My CRViewer control always previews using DEFAULT system printer but I want the user to change printer in previewing.

I tried using Report.SelectPrinter but it only works for printing (on paper) or exporting. It doesn't affect previewing on CRViewer control. It always uses the system default printer. Printing on paper or exporting always use correctly the printer the user selects (with SelectPrinter) but the only way to change printer for previewing is change default system printer.

My question is: How can i change printer for PREVIEWING ?

Note: this is really important because the user must have for several reasons a Generic / Text Only printer as default system printer, but he has to preview and print on a laserjet printer. In this context, after selecting printer, the preview window always uses "Device Font" instead of "Times New Roman" also if printing on paper is correct.

Many thanks in advance!

Selecting The Paper Tray Of Printer
Guys,
i Have HP LaserJet 4600 dtn printer. It has three paper trays. So i want to select the paper trays of the printer programmatically. Does any one have any idea about this.
Thanx.

Zia.

Selecting Default Printer Using Commondialog
I am trying to allow the selection of printer at runtime using commondialog.showprinter

This works fine before anything is printed but refuses to change the printer after any printing has taken place.
I use
Code:form.printform
Printer.EndDoc

to output the form to the printer

any ideas??

Thanks

Selecting Printer Using Crystal Report In VB6
Hello,

I would be grateful if someone could help me to be able to select a printer whilst using crystal report 8 with Visual Basic 6.

Thanks

CR Reports / Selecting Printer Prior To Printing
Currently I am accomplishing my printing of CR reports via the print button on my CRViewer1. The problem I am having is that it always prints to the default printer.

Is there a way which i can allow my users to select a printer when printing?

Selecting Default Printer / Manual / Pdf File
In my pc I am having more than one printer is installed. Sometimes I want to
direct to default printer and some time to other printer. And sometime I
would like to print as PDF file. How I can do this? If anyone has piece of
code, can you send it to me.

Regards
Arun Kumar Rodrigues
M.A.R. Al Bahar
P.O.Box 6038
Sharjah, U.A.E.

Tel No: 00971 6 5141343 (Direct)
00971 6 5431271 (Board)
Fax No: 00971 6 5423769
Email : email@removed

Automatically Selecting The Correct Printer (print Driver)
How do you automatically select a defined printer before you perform a "printreport" ?

For example:

If I have a sales report that I always want printed on a printer called "Printronix P5000"... How would I programatically select that printer for the report ?


Thanks in advance for any help !!!!

Selecting Paper Source On Printer Based On Word Document
hello, I have some different type of MSWORD documents (label, letter head, envelops etc.) that I want to be printed on different trays of my printer automatically as I have different paper types loaded in each tray. I have templates of these documents and RICOH (http://www.ricoh-usa.com) 1060 and 1075 printers. These printers have different trays for different types of paper and can be reconfigured to load various types of paper. My application runs as a batch job and has to print lots of documents unattended. I want to select different printer tray based on different type of document template. I can enable paper source in template but the tray configuration can be changed on the printer so I can not rely on that. Also macros are not available so that option is also out. I need to do it from with in my application.
I am using VB6 on Windows 2000 machine.

Using Selecting In Excel
Dear VB users,

In my VB program I want to select in an opened Excel sheet a part of the sheet.

After the selecting the program must know what the selecting was.

How do I do that?

Knows somebody an answer?

Nice greetings,

Michelle.

EXCEL - Selecting A Row
Please tell me what's wrong with this code:
Code:For a = 1 to 20
     Sheets("New Personnel").Range("BB" & a).EntireRow.Select
     Selection.Cut
     Selection.Delete Shift:=xlUp
Next
the error I get is:Quote:1004 Select method of Range class failed
and vb doesn't like this line: Quote:Sheets("New Personnel").Range("BB" & a).EntireRow.Select

any ideas on what could be wrong? Or anyone know of a better algorithm?

Thanks!

BTW: I'm new to these forums, and so far I like them a lot!

 

Edited by - Lodbot on 7/29/2003 1:42:26 PM

Selecting An Excel Sheet With VBA
i have this bit of code below in access97 which does not work. All i want to do is select a sheet in excel without actually hard coding the name in hence the strName string. strName holds the correct name but if i put it in the 2nd line below i get a subscript out of range error ? Am i missing something ?

Can anyone shed any light on this for me ?


strName = Left(outputName, Len(outputName) - 4)
XLapp.Sheets(strName).Select



thanks
Paul

Selecting A Range In Excel
I have this really long macro that looks like this:

Code:
Sub Macro1(lquota As Long)
Workbooks.Add
Sheets("Sheet1").Select
Columns("B:B").ColumnWidth = 8
Columns("C:C").ColumnWidth = 25
Columns("D:D").ColumnWidth = 12
Range("B1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Font.Bold = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.FormulaR1C1 = "DATE"
Range("C1").Select
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.FormulaR1C1 = "RESP. #"
Range("D1").Select
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
ActiveCell.FormulaR1C1 = "VFY.IN"
Range("A1:D54").Select 'this part here
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("a1").Select
Dim i As Long
i = 2
Dim temp As String
For i = 2 To lquota
Cells((ActiveCell.Row + 1), ActiveCell.Column).Select
ActiveCell.FormulaR1C1 = (i - 1)
Next
ActiveWorkbook.SaveAs FileName:="c: emp.rcd", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
End Sub
the part that says
Range("A154").Select
I want to make variable from A1 to D?
how can I do this. Thanks
Rob

Selecting From Printers In Excel VBA
Hello;

I need to be able to select a specific printer for one type of print, and another for another type of print. I can use the Application.ActivePrinter property, but is expects a format like this;

"\myprintservermyprinter on Ne01:"

This seems fine, until later you try to run the code, and the printer is now calling itself "\myprintservermyprinter on Ne03:"

Does anyone know of a way to get the list of available printers within VBA code so that I can parse for the right printer and use that in the ActivePrinter property?

Thanks a bunch

Art

Selecting Rows In Excel
I want to be able to select a series of sequential rows in an Excel worksheet with variables as the parameters. When I record a macro and select rows the VB code looks like this:

Rows("1:6").Select

What I want to do is select rows from the i'th to the j'th row like this:

Rows("i:j").Select

where i and j and pre-defined integers. This code makes a syntax error however and I cannot figure out what the proper syntax is. Can anyone help me out?

Selecting Excel Tabs - Without Tab Name
How can a macro select "all" tabs (or specific ones) without having to write in each tab name? My tab names might change, so I'd like to be able to select them all, or select sheets #2-6, 8, 11-21, etc., and print?

Thanks much!

Selecting A Excel Cell From Vb6
How to read data from Excel. Make sure you reference MS Excel Object Library 8.0 or 9.0 in VB.


VB Code:
Private Sub Command1_Click()Dim row As IntegerDim col As IntegerDim row_end As IntegerDim col_end As IntegerDim dblArray() As Double     Dim objExcel As Excel.Application        On Error Resume Next    ' grab Excel if open    Set objExcel = GetObject(",Excel.Application")    ' if error - not open    If Err.Number <> 0 Then        ' open it        Set objExcel = CreateObject("Excel.Application")    End If    Err.Clear    On Error GoTo 0        ' make it visible    objExcel.Visible = True    ' open normal    objExcel.WindowState = xlNormal        ' open file    objExcel.Workbooks.Open FileName:="C:Book5.xls", ReadOnly:=True        ' run macro - not used here    'objExcel.Run "Macro1"        ' set up aray to hold values read from Excel    ReDim dblArray(1 To 200)       '  select a column    objExcel.Range("F1").Select        ' get max rows    row_end = ActiveCell.End(xlDown).Rows.row     ' get max columns - not used here    'col_end = ActiveCell.End(xlToRight).Columns.Column        ' to grab one cell - not used here    'strMyVar = objExcel.Cells(1, 2)     row = 1    col = 6   ' colume F    ' loop from row 1 to row_end, column 6    Do Until row > row_end        dblArray(row) = objExcel.Cells(row, col)        row = row + 1    Loop        ' cut array to proper size    ReDim Preserve dblArray(1 To row - 1)        ' show grabbed values    For row = 1 To UBound(dblArray)        Debug.Print dblArray(row)    Next row        ' close workbook - no save    objExcel.ActiveWorkbook.Close SaveChanges:=False    ' close Excel    objExcel.Quit    ' clean up    Set objExcel = Nothing        ' close form    Unload MeEnd Sub

Selecting A Range In Excel
Okay, I am working with an excel document and I have an input box coming up asking for a range, I have the string for selecting the range, but I need that put in to a variable, what kind of variable does it need to be? Nothing seems to work! Please help.

Thanks in advance

Selecting A Range In Excel
I am trying (unsuccessfully) to take a value from a cell in Excel and use that value to determine how many cells in a column to select.

For Eg. If A1=10, I want to select Range("C10:C 10+10")

I have tried

CellNo = 10
cellchk = "$C$" & CStr(CellNo)
Range(cellchk).Select
Selection.AutoFill Destination:=Range("C10:"$E$" & CSTR ......
............ (CellNo)"), Type:=xlFillDefault

But this doesnt work.
It works fine when selecting a 1 entry range

cellchk = "$C$" & CStr(CellNo)
Range(CellChk).Select

but not when selecting a multi entry range.

The program I am working on feeds its values into Excel to sort results, produce graphs etc.
Hopefully someone has come across a similar problem and can help me out.
Cheers.

Selecting A Certain Cell In Excel
Hi all,
I am working on a project that is using the VB in Excel. I am trying to figure out how to select a certain cell. Basically, I have a column of numbers and these numbers start at 21 then go down to about 3 and then climb back to 21. They are in one column and consist of 4,120 rows. I have an inputted value, say 13, I need to search though the column of numbers and select the first cell that is just before the cell that is &lt;= 13. Then I need to use that row number to identify where the data should start being used for calculation i.e. delete all data above that row indicator. An suggestions would be greatly appreciatted.

Selecting Data From Excel With Condition
Hi

I want to fetch the data from excel to the MS Flexgrid using some condition.

e.g Say in work sheet "aa.xls" there is data in col A with that respect data is in furthur column

Data is repeated in col A , there is client no in col A , date of trans in col B

so it is quite obvious a particular client no repeat again n again with different date of transaction

Now I want to fetch a data from this sheet of a particular client using client no say " C001 " into Flexgrid

Can any one help me

Thanks in advance

Dhiraj

Selecting Cells In Excel..Not As Easy As You Think.
Ok..I have done this in Excel..Found the first row in the spreadsheet containing data:

Range("A1").Select

Do While ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
ActiveCell.Offset(0, 25).Select

Now what I want to do is take the next 25 cells of data, cut them and paste them starting in the first column under the existing row of data.

Selecting The Active Line In An Excel Doc
Is is possible to select the active row in an excel document using SQL and if so: How????

i need to make a merged *.doc file containing the data from the active row but I haven't got a clue on how to do this..... could anyone plz Help me?

Excel...Selecting Only Cells With Values...
Can someone please tell me how to select only cells with values in vba (for a dynamic charting algorithm). I'd also like to ingnore the values in the data headings (in row 1 and column A), how can I do this?

Thanks

Selecting 2 Columns In Excel From Access...
Office XP

i have the following bit of code which bolds 2 columns in an excel spreadsheet from within an Access program.


Code:
.Range("B5").Select
.Range(Selection, Selection.End(xlDown)).Select
.Selection.Font.Bold = True
.Range("F5").Select
.Range(Selection, Selection.End(xlDown)).Select
.Selection.Font.Bold = True
is there a way to shorten this by combining the range to incorporate the 2 columns at the same time but only the 2 columns ? i can then reduce the code duplication a bit.

maybe something like .Range("B5:F5") ?
hmmm i'll have to give that a go when i try it later......<Edit>just tried this and it is not what i need. i do NOT want columns C, D and E to be in the range.<End edit>

any advice appreciated
Paul

Excel Question - Selecting All Sheets
I am a novice at VB but have now started writing some macros for Excel that I use in my job.

I want to use the code: Sheets.Select, and this works fine as long as no worksheets are hidden (or very hidden). The workbooks I use at work are created by others, therefore, I have no control over the tab names, but I would like to select all the tabs before saving the file.

Can anyone help the newbie to VB? (Many, many years ago I programmed in Burroughs Basic and then COBOL for Burroughs mainframe - am I dating myself?

Selecting Excel Sheet Range
Hi, I need to select the range between two columns.
The first range is TwoDRangeB = 17 ' Range Begins Cell 17
The 2nd range is TwoDRangeE = 27 ' Range Ends Cell 27

They both belong to the same column, per say "A"

How can I select this whole Range using these Variables?

I am using this format, but it does not work:

Code:
Range("TwoDRangeB:TwoDRangeB").Select
I get a message: Run_Time Error '1004'
Method 'Range' of Object '_Worksheet' Failed

How can I assign these values to belong to Column A?
Thank you

Selecting Excel Sheet Range
Hi, I need to select the range between two columns.
The first range is TwoDRangeB = 17 ' Range Begins Cell 17
The 2nd range is TwoDRangeE = 27 ' Range Ends Cell 27

They both belong to the same column, per say "A"

How can I select this whole Range using these Variables?

I am using this format, but it does not work:

Code:
Range("TwoDRangeB:TwoDRangeB").Select

I get a message: Run_Time Error '1004'
Method 'Range' of Object '_Worksheet' Failed

How can I assign these values to belong to Column A?
BTW: I am using Si_The_Geek's Tutorial as usual.
Thank you

MS Excel - Selecting A Range Using The Last Cell
Hi! Can you help with this problem... it may seem really simple, but I'm new to VB so it's proving to be a little tricky (for me!). Basically the problem is this; using code I've written a VB macro that will present data in a more "visually friendly" format. This is done in Excel. The only thing I'm having problems with is border style. The thing is the macro is to be used on many different sources of data and there will never always be the same number of records (rows) in the spreadsheet each time. Therefore, what I'm trying to do is select all of the cells up to and including the last cell and then format the cells so that they have a border. At the moment I've had to define a range and then afterwards I manually delete the excess cells. Is this possible?

If you can help, I'd be very grateful... not to mention relieved in not having to manually delete cells I don't need.

Thanks.

Selecting The Next (excel)pivottable Item Via VB
Hello,
I have a pivottable in Excel in which I want to select the first item, print the data, select the next, print the data etc until the last one. Not every item is always in the list.
Now I do it manual, but I want to automate it.
Now I have this VB:

**
Sheets("PivotInfo").Select
ActiveSheet.PivotTable
("PivotPosted").PivotFields("Dealer").CurrentPage = "item1"
ActiveWindow.SelectedSheets.PrintOut Copies:=1
**

Now I want the script to select the next item after item1 is printed.

Any help will be appreciated!

Thanks,
Mark.

Selecting Current Rows In Excel
I am writing a Macro in Microsoft Excel.

I know that to select e.g. row 5, I would code:

rows("5:5").select.

However, if I use a variable to move about the worksheet i.e. Range("A" & targetrow).Select (where targetrow is a variable), I can't hard-code the row selection as above.

Is there syntax to use a variable in the rows().select statement, or is there anyway of selecting 'the current row'?

Selecting Rows/columns In Excel
Hi,

this is a very simpy question (and what bugs me I used to know the answer, but I have forgotten it and can't remember).

I want to create a comboBox in Excel and then display the contents of other cells dependend on what I have chosen in the comboBox.

Basically it would be a case where the cell displaying the result would have something like this:
=Ji
J being the column (constant)
i being depended on the result in the 'cell link' field.

J1 would contain the first information being chosen
J2 the second and so forth

Right now Excel doesn't recognize the 'i' as a variable and complains (how do I tell it that it is one?)

Thanks, PJ

Selecting A Range Of Cells In Row Using VB In Excel
Hey all,

This is probably an easy question for you......

What code can I write to select a range of cells in a row?
For example:

I want to go down to the bottom of column B (which I can) then I want to select the next 5 cells to the right of it so I can format them with borders.

Ive tried sendkeys (which dont work!) and also code similar to this:

Range(Selection, Selection.End(xlRight)).Count

which i was told selects all the cells that have values in, which would have been good enough but again doesnt work.

Any ideas/suggestions would be greatfully appreciated.

Cheers,
Gary

Selecting First And Last Rows Excel Macro
The second part to a post that I made early involves creating a macro that will select the first and last date/time stamps from a Excel log file. In colum A there are employee names. In column B there are date/time stamps from the event log on the file server. It looks something like this



What I need the macro to do is copy the first time and last time for each employee and paste those two values to column D without any blank rows in between. So from this screen shot column D would be:

6/11/2007 8:54:48 AM
6/11/2007 8:28:03 AM
6/11/2007 8:42:36 AM
6/11/2007 8:40.02 AM
6/11/2007 8:33:27 AM
6/11/2007 8:29:39 AM

Any help would be great!

Selecting A Flexible Range In Excel
Hi all,

I've gotten a long way with my application, but now it's generating an error
to which I know no response. I hope any of you can (and will) help me. Below
is the code. It's a simple piece of code which should select a flexible
range (one column wide) on one worksheet and copy it to another. Where
things go wrong is in the last part of the code, for some reason the range
is not selected properly. I've tried adding quotation marks to it, but that
generates an error upon leaving the line. How do I get the proper selection
for copying?
Thanks in advance,
Punky

Public Sub StandOpmaken()
Dim stLaatsteRace As String
Dim iDeelnemers As Integer
Dim iBereik As Integer
Dim stUitslag As String
Dim stPunten As String

Worksheets("Deelnemers").Activate
iDeelnemers = ActiveSheet.Range("K1").Value
iBereik = 3 + iDeelnemers 'returns 12, which is OK
stUitslag = ("A4, A" & iBereik) ' returns A4, A12, which it should
stPunten = ("M4, M" & iBereik) 'teturns M4,M12 as expected

' totaalstand kopiŽren
ActiveSheet.Range(stUitslag).Copy _
Destination:=Worksheets("Stand").Range("a1")
ActiveSheet.Range(stPunten).Copy _
Destination:=Worksheets("Stand").Range("b1")
Worksheets("Stand").Range("uitslag").Sort _
key1:=Worksheets("Stand").Columns("B"), _
order1:=xlDescending, _
header:=xlYes

--
Punky

Leven is leven dat leven wil te midden van leven dat leven wil (dr. A.
Schweitzer)

Selecting Between Sheets In A Excel Workbook With Vb.net
Hi there again,


Can anyone help I need to select between 2 difrent sheets in a open excel workbook.

I open the spreadsheet from a location on my hdu and then need the second sheet to be active in this spread sheet, how do i do this



Thanx


Tommy






Edited by - kalahariferrari on 2/23/2005 11:55:41 PM

Selecting A Range Of Sheets In Excel In VBA
I'm trying to select a range of sheets in an Excel Workbook.
The number of sheets may differ and their names may differ but they will never be all the sheets in the workbook.
I have tried the following:

Dim X As Long
Dim FirstSheet As String
Dim LastSheet As String
X = Sheets.Count
FirstSheet = "High Street"
LastSheet = "King George Street"
Sheets(Array(FirstSheet, LastSheet)).Select

But this selects only the first and the last sheet.
Is it possible to also select the sheets between FirstSheet and LastSheet ??

Selecting Rows From A Excel Source
From an Excel Sheet, I need to extract data to be displeyed in VB as a list. I need to extract only the rows that match with certain criteria.
I tried using a ListBox, but I can't find a method to perform this desired filter.
Also, using filters directly in Excel, VB can't recongnice it.

Does anyone can help me?

Thks in advance,

RFJ

[How To] Selecting All Excel Cells From Source Code
Hey,

I would like to select all the cells of my excell sheet from the vb code, anyone can help me?

thanks
P.

Selecting A Range Of Cells From Excel Via VB Code
Ok this seems like it's doable.

What I want to do select a range from excel, copy that range, and then paste it to a new spreadsheet. Then go back move down 49 rows and select the same size range.

I know if you want to select a certain cell you use:

Cells(1,1)

which would select cell A1 in Excel.

But what I want is to select cells A4:K52 (Range), but I don't want this set to a hard location like Range("A4:K52").Select would. I need it to loop 49 lines to A53:K101, select that, then A102:K150, select, etc.

Any ideas, I'm sure this is a no brainer for someone.

Thanks,

Matt

Copyright © 2005-08 www.BigResource.com, All rights reserved