ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to check column name in multiple sheet (https://www.excelbanter.com/excel-programming/385850-how-check-column-name-multiple-sheet.html)

[email protected]

How to check column name in multiple sheet
 
How to write a macro which will open up a dialogue box and asked user
to select a particular excel file.Now selecting a excel workbook which
has multiple worksheets. such as A1, A2, A3 ...etc. Each worksheet has
a column name(e.g, class name, parent name..). It should copy the
content of each worksheet to another file based on column name
checking(i,e,if the column name is same) some value.


JLGWhiz

How to check column name in multiple sheet
 
Your description of the requirement is pretty vague but I have put
together a scenario to give you an idea of an approach to a solution.

1. How to write a macro which will open up a dialogue box and asked user
to select a particular excel file.

-Let's start with the simple Method

selectFile = InputBox("Enter one of the following file names:" & Chr(13) &
"FileName1" & Chr(13) & "FileName2", "File Name")
'The Chr(13) inserts a carriage return so the files will be on separate lines.

2. Now selecting a excel workbook which has multiple worksheets. such as
A1, A2, A3 ...etc.

-This should be the result of the selection in 1 above

Workbooks.Open Filename:=selectFile

3. Each worksheet has a column name(e.g, class name, parent name..).

- This is normally developed by the creator of the workbook.

4. It should copy the content of each worksheet to another file based on
column name

checking(i,e,if the column name is same) some value.

- Assuming the range is named myRange

If myRange cells(1, 1) < "" Then
Worksheets(1).Cells.Copy Workbooks(2).Worksheets(1).Range("A1")
End If

" wrote:

How to write a macro which will open up a dialogue box and asked user
to select a particular excel file.Now selecting a excel workbook which
has multiple worksheets. such as A1, A2, A3 ...etc. Each worksheet has
a column name(e.g, class name, parent name..). It should copy the
content of each worksheet to another file based on column name
checking(i,e,if the column name is same) some value.



[email protected]

How to check column name in multiple sheet
 
hi,
thanks for the suggestion, but my problem is not yet resolved.
Actually I want to open a excel workbook which contains multiple
worksheet. Each work sheet has column name. Now i want to check if the
column name given in that particular worksheet is (eg sr. no, class
name, parent name, description), if it matches then only open that
work book otherwise pop up a error message.so what should be the macro
code for that....

thanks in advanced
suraj



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

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