Thread: Move Column
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Socko Socko is offline
external usenet poster
 
Posts: 28
Default Move Column

As per already sd, you need to be a bit more descriptive of what you
need. However, I tried something which you can look at to find if this
would be your solution.

Create a worksheet function which will give the name of a sheet by
index. Copy the code below and paste it in a standard code module.

Function SheetByIndex(ByRef Index As Long) As String
SheetByIndex = ActiveWorkbook.Sheets(Index).Name
End Function

Once you do this, type the formula below in one of your cell A1...
=SheetbyIndex(1)

This will give you the name of the 1st sheet. Now you can also use
indirect cell reference to get the content of a cell....
suppose you want the content of A1 in 1st sheet (suppose 1st sheet is
Sheet1)...

syntax for Address Function
ADDRESS(row_num,column_num,abs_num,a1,sheet_text)
where Row_num is the row number to use in the cell
reference.
Column_num is the column number to use in the cell
reference.
Abs_num specifies the type of reference to return.

Type the following formula in cell A2
= Indirect("Sheet1!"&$A$1)

The cell A2 will show the content of cell A1 in "Sheet1"... Rather
than typing out each and every reference, you can use the worksheet
function called "address"...
Type out the formula below in A3.

=ADDRESS(ROW()-2,1,1,1,$a$1)

The above formula will return string as "Sheet1!$A$1".

Based on all these three logic, you can show the contents of any and
all sheets of the workbook without much hardwork, and you will see
that you are not using any macro other than customer user defined
function to return sheet name as string...

You may have a look at an example workbook which can be downloaded
from the following link.

http://www.sockofiles.350.com/summaryinmaster.xls

I hope this helps.

Selva V Pasupathy
For more on Excel, VBA, & other Resources
Please visit: http://socko.wordpress.com