ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro - use variable integer as text (https://www.excelbanter.com/excel-programming/361676-macro-use-variable-integer-text.html)

Drahos

Macro - use variable integer as text
 
Dear Colleagues,
can somebody help me to find a solution how to use a varible integer in a
macro as a part of text string?
I have in my macro a varible X which contains a figure representing the
number of rows in a spreadsheet. This amount is different in differnt
workbooks. For example now it is X = 50.
Now I need to incorporate this variable to a range declaration. For
example:
Range("D2:D50").select
Here I need to have the figure 50 to be replaced by the variable X.

Thanks a lot for your help.
Drahos.

Xcelion

Macro - use variable integer as text
 
Hi Draho,

Use Range("D2:D" & x ).select

Thanks
Xcelion

"Drahos" wrote:

Dear Colleagues,
can somebody help me to find a solution how to use a varible integer in a
macro as a part of text string?
I have in my macro a varible X which contains a figure representing the
number of rows in a spreadsheet. This amount is different in differnt
workbooks. For example now it is X = 50.
Now I need to incorporate this variable to a range declaration. For
example:
Range("D2:D50").select
Here I need to have the figure 50 to be replaced by the variable X.

Thanks a lot for your help.
Drahos.


Drahos

Macro - use variable integer as text
 
Hi Xcelion,

thanks a lot. Simple and working. I have supposed that there should be a
simple and elegant solution.

I would like to ask you one more question. Looking to to the Modules in
my PERSONAL.xls I see a lot of them. Something about 60. Looking into these
Modules I see almost all of them are empty. I suppose they were created on
the base of macro recording. Is it possible to remove all empty Modules? I
suppose there should be the same number of Modules as I have the number of
macros in my PERSONAL.xls (listed in the list of macros). If possible to
delete them will they be automatically renumerated? I mean from Module1 to
Module11 for example.

I very appreciate your help.

Drahos.

"Xcelion" wrote:

Hi Draho,

Use Range("D2:D" & x ).select

Thanks
Xcelion

"Drahos" wrote:

Dear Colleagues,
can somebody help me to find a solution how to use a varible integer in a
macro as a part of text string?
I have in my macro a varible X which contains a figure representing the
number of rows in a spreadsheet. This amount is different in differnt
workbooks. For example now it is X = 50.
Now I need to incorporate this variable to a range declaration. For
example:
Range("D2:D50").select
Here I need to have the figure 50 to be replaced by the variable X.

Thanks a lot for your help.
Drahos.



All times are GMT +1. The time now is 09:44 AM.

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