ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   2 Question: Coloumn width, Filename (https://www.excelbanter.com/excel-worksheet-functions/17619-2-question-coloumn-width-filename.html)

nopfusch

2 Question: Coloumn width, Filename
 
1 How do I enter as a function the current filename or another filename
into a cell?
If I click on the cell coyaining another filename, the file should open. Is
it possible without macros, if the (another) file is in the same folder?
2 I want to display in line one, for each coloum the width, e.g. 6.33.
The nummer representing the width should - if I change the width - change
accordingly .
Possible???
Thanks
nopfusch

PeterAtherton

Hi

I've written a couple of functions that will give you what you want. Copy
them into a Visual basic module in your book. (ALT+F11,Insert,Module). You
can thenuse the functions as normal.

Function fName()
Dim wb As Workbook
Set wb = ActiveWorkbook
fName = wb.Name
End Function

Enter =fname() in a cell to return the current file name.

Function ColWidth(c)
Application.Volatile
ColWidth = c.ColumnWidth
End Function

In A1 type =colwidth(A1) to return the column width in the format you want.

You could have used Excel's CELL function to return the column width to the
nearest whole number.

e.g =CELL("Width",D7)

regards
Peter



"nopfusch" wrote:

1 How do I enter as a function the current filename or another filename
into a cell?
If I click on the cell coyaining another filename, the file should open. Is
it possible without macros, if the (another) file is in the same folder?
2 I want to display in line one, for each coloum the width, e.g. 6.33.
The nummer representing the width should - if I change the width - change
accordingly .
Possible???
Thanks
nopfusch


nopfusch



"PeterAtherton" wrote:

Hi

I've written a couple of functions that will give you what you want. Copy
them into a Visual basic module in your book. (ALT+F11,Insert,Module). You
can thenuse the functions as normal.

Function fName()
Dim wb As Workbook
Set wb = ActiveWorkbook
fName = wb.Name
End Function

Enter =fname() in a cell to return the current file name.

Function ColWidth(c)
Application.Volatile
ColWidth = c.ColumnWidth
End Function

In A1 type =colwidth(A1) to return the column width in the format you want.

You could have used Excel's CELL function to return the column width to the
nearest whole number.

e.g =CELL("Width",D7)

regards
Peter

Thanks, Peter
Maube I have to come back for help, but first I want to try this out.
Regards
nopfusch
















"nopfusch" wrote:

1 How do I enter as a function the current filename or another filename
into a cell?
If I click on the cell coyaining another filename, the file should open. Is
it possible without macros, if the (another) file is in the same folder?
2 I want to display in line one, for each coloum the width, e.g. 6.33.
The nummer representing the width should - if I change the width - change
accordingly .
Possible???
Thanks
nopfusch



All times are GMT +1. The time now is 02:51 AM.

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