ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Macros (https://www.excelbanter.com/excel-programming/352505-help-macros.html)

Clinton M James[_2_]

Help with Macros
 
Hey all,

I was hoping that somebody out there may be able to help me with some macro
issues and questions.

First off, I have this line in a macro I have made:

Worksheets("Claim Label Template").PageSetup.PrintArea = "$A$1:$I$26"

this works well, but the problem is in another macro whereby there is to be
variable amount of lines.

I have a variable that always knows how many lines in the sheet there are,
and the columns are a constant. Problems is I aways get a run time error
1004 attempting to make this statement variable. I have tries using range
cells, but all with the same error. Is there a smiple code liek the one I
have mentioned that will take, say R for rows, and allow me to set the print
area to the number of rows up to column d?


Beside this, I am curious to know if it is possible to do the follwoing:

At work, we have Adobe Acrobat installed. We have a task ahead whereby we
will need to get several pdf files and join them into one file. This task
needs repeating many times for different files.

I can select on the files and right click to get the option to join the
files then acrobat launches in and joins them, then I have to save them.

Is it possible to write an macro in excel to read file names, say along each
row and somehow have excel (through the macro) run acrobat, joining these
files together, then saving the result in a directory that will change name
for each conglomeration?

Any help is very much appreciated!

Regards,
Clint



Don Guillett

Help with Macros
 
something like
Sub setprintareasheet1()
With Sheets("sheet1")
'automatic
r = .Cells(Rows.Count, "k").End(xlUp).Row
'or ask for input
'r=inputbox("number of rows please)
..PageSetup.PrintArea = Range("a2:k" & r).Address

End With
End Sub

--
Don Guillett
SalesAid Software

"Clinton M James" wrote in message
...
Hey all,

I was hoping that somebody out there may be able to help me with some
macro issues and questions.

First off, I have this line in a macro I have made:

Worksheets("Claim Label Template").PageSetup.PrintArea = "$A$1:$I$26"

this works well, but the problem is in another macro whereby there is to
be variable amount of lines.

I have a variable that always knows how many lines in the sheet there are,
and the columns are a constant. Problems is I aways get a run time error
1004 attempting to make this statement variable. I have tries using range
cells, but all with the same error. Is there a smiple code liek the one I
have mentioned that will take, say R for rows, and allow me to set the
print area to the number of rows up to column d?


Beside this, I am curious to know if it is possible to do the follwoing:

At work, we have Adobe Acrobat installed. We have a task ahead whereby we
will need to get several pdf files and join them into one file. This task
needs repeating many times for different files.

I can select on the files and right click to get the option to join the
files then acrobat launches in and joins them, then I have to save them.

Is it possible to write an macro in excel to read file names, say along
each row and somehow have excel (through the macro) run acrobat, joining
these files together, then saving the result in a directory that will
change name for each conglomeration?

Any help is very much appreciated!

Regards,
Clint




avveerkar[_38_]

Help with Macros
 

Clinton M James Wrote:
Hey all,

I was hoping that somebody out there may be able to help me with some
macro
issues and questions.

First off, I have this line in a macro I have made:

Worksheets("Claim Label Template").PageSetup.PrintArea = "$A$1:$I$26"

this works well, but the problem is in another macro whereby there is
to be
variable amount of lines.

I have a variable that always knows how many lines in the sheet there
are,
and the columns are a constant. Problems is I aways get a run time
error
1004 attempting to make this statement variable. I have tries using
range
cells, but all with the same error. Is there a smiple code liek the one
I
have mentioned that will take, say R for rows, and allow me to set the
print
area to the number of rows up to column d?


Beside this, I am curious to know if it is possible to do the
follwoing:

At work, we have Adobe Acrobat installed. We have a task ahead whereby
we
will need to get several pdf files and join them into one file. This
task
needs repeating many times for different files.

I can select on the files and right click to get the option to join
the
files then acrobat launches in and joins them, then I have to save
them.

Is it possible to write an macro in excel to read file names, say along
each
row and somehow have excel (through the macro) run acrobat, joining
these
files together, then saving the result in a directory that will change
name
for each conglomeration?

Any help is very much appreciated!

Regards,
Clint


I perhaps can suggest solution for the first part. You said that number
of lines can vary and the number is given by variable R then you can
concatenate the string for page setup. Your could write

R = 26 ' variable which has line count
abc = "$A$1:$I$"
abcd = abc & R
Worksheets("Sheet1").PageSetup.PrintArea = abcd

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=508913



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

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