ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visual Basic to reference value in Excel cell (https://www.excelbanter.com/excel-programming/280827-visual-basic-reference-value-excel-cell.html)

Raymond[_4_]

Visual Basic to reference value in Excel cell
 
I have a small program, and in a particular cell, I ask a
user to enter the number of copies they want printed when
they push the button linked to the printpages macro I
made. In the macro I want to change the "Copies:=1" so
that rather than a 1, it will reference the value of the
cell they entered the number of copies desired. I tried

ActiveWindow.SelectedSheets.PrintOut Copies:=Cells
([g], [22]), Collate:=True Range("E4").Select

But that didnt work. I dont know much about VB or how to
use it in conjunction with Excel, but anyone who can help
me fix this is greatly appreciated!

Ray

Serge[_5_]

Visual Basic to reference value in Excel cell
 
Ray try using:
Range("G22").value or Cells(7,22).value

-----Original Message-----
I have a small program, and in a particular cell, I ask a
user to enter the number of copies they want printed when
they push the button linked to the printpages macro I
made. In the macro I want to change the "Copies:=1" so
that rather than a 1, it will reference the value of the
cell they entered the number of copies desired. I tried

ActiveWindow.SelectedSheets.PrintOut Copies:=Cells
([g], [22]), Collate:=True Range("E4").Select

But that didnt work. I dont know much about VB or how to
use it in conjunction with Excel, but anyone who can help
me fix this is greatly appreciated!

Ray
.



All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com