ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Select Range based on column name and not A1 notations (https://www.excelbanter.com/excel-discussion-misc-queries/194950-select-range-based-column-name-not-a1-notations.html)

T.Vidak

Select Range based on column name and not A1 notations
 
Within a macro, instead of selecting the alphanumeric notations for a column
(i.e. C1,E1) can I use the column title (i.e. ID, Last Updated)? I need to
copy the same three columns over and over again from the Master spreadsheet
into multiple spreadsheets but the data is not always in the same
positio/column in the Master. Thanks for your help, T.

Bob Phillips

Select Range based on column name and not A1 notations
 
You could get the column numbered with

colNo = Application.Match("ID",Rows(1),0)

and use the column number.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"T.Vidak" wrote in message
...
Within a macro, instead of selecting the alphanumeric notations for a
column
(i.e. C1,E1) can I use the column title (i.e. ID, Last Updated)? I need to
copy the same three columns over and over again from the Master
spreadsheet
into multiple spreadsheets but the data is not always in the same
positio/column in the Master. Thanks for your help, T.




FSt1

Select Range based on column name and not A1 notations
 
hi
i'm confused. you say you copy the same column but that it's not always in
the same position/column????? is the column shifting for some reason?

Regards
FSt1

"T.Vidak" wrote:

Within a macro, instead of selecting the alphanumeric notations for a column
(i.e. C1,E1) can I use the column title (i.e. ID, Last Updated)? I need to
copy the same three columns over and over again from the Master spreadsheet
into multiple spreadsheets but the data is not always in the same
positio/column in the Master. Thanks for your help, T.


T.Vidak

Select Range based on column name and not A1 notations
 
Yes, the master spreadsheet is created by merging information from multiple
sheets together (I have created a macro to do this). Once changes are applied
in the Master I need to split the information back into the 7 sheets. The
original sheets don't always have the same number of columns therefore the
column numbers on the Master keep shifting with every new cycle.
Consequently, the reference numbers for the 2 columns I need to copy into all
7 sheets are shifting. I have created a macro to split the rest of the
information but I can't get around this problem. Thanks, T

"FSt1" wrote:

hi
i'm confused. you say you copy the same column but that it's not always in
the same position/column????? is the column shifting for some reason?

Regards
FSt1

"T.Vidak" wrote:

Within a macro, instead of selecting the alphanumeric notations for a column
(i.e. C1,E1) can I use the column title (i.e. ID, Last Updated)? I need to
copy the same three columns over and over again from the Master spreadsheet
into multiple spreadsheets but the data is not always in the same
positio/column in the Master. Thanks for your help, T.



All times are GMT +1. The time now is 02:27 PM.

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