Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Column Counting

Hello

i have a spreadsheet that upon opening, it counts all the spreadsheets (n)
that are also open and are named inclusively between 1 and 25. it then enters
the values 1, 2, 3....n in column A5:A25.

thanks

Lawson
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Column Counting

and the question is ...?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"lawson" wrote in message
...
Hello

i have a spreadsheet that upon opening, it counts all the spreadsheets (n)
that are also open and are named inclusively between 1 and 25. it then

enters
the values 1, 2, 3....n in column A5:A25.

thanks

Lawson



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Column Counting

Hi,

Just need some clarifications to answer your question. Do you mean that the
code should record the names of all the open workbooks in A5:A25? Are they
named 1.xls, 2.xls etc? Also you probably meant A1:A25 if all 25 were open
and their names had to be recorded?

Alok

"lawson" wrote:

Hello

i have a spreadsheet that upon opening, it counts all the spreadsheets (n)
that are also open and are named inclusively between 1 and 25. it then enters
the values 1, 2, 3....n in column A5:A25.

thanks

Lawson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Column Counting

hi back!

no, i dont want it to record the names. i want it to count the spreadsheets
if and only if they're names are 1.xls, 2.xls...25.xls, then enter the values
1 through n in (what i should have typed the first time) a5:a:30. if there
are only 5 spreadsheets open (ie 1.xls, 2.xls...5.xls) then it starts in a5
and enters 1, 2 in a6,...5 in a9

thanks a million

"Alok" wrote:

Hi,

Just need some clarifications to answer your question. Do you mean that the
code should record the names of all the open workbooks in A5:A25? Are they
named 1.xls, 2.xls etc? Also you probably meant A1:A25 if all 25 were open
and their names had to be recorded?

Alok

"lawson" wrote:

Hello

i have a spreadsheet that upon opening, it counts all the spreadsheets (n)
that are also open and are named inclusively between 1 and 25. it then enters
the values 1, 2, 3....n in column A5:A25.

thanks

Lawson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Column Counting

Hi

Copy this code in the Workbook_Open event of your workbook
You may need to refine this code as needed

Dim wb As Workbook
Dim s$, i%
For Each wb In Workbooks
If Not wb Is ThisWorkbook Then
On Error Resume Next
i = Val(Mid$(wb.Name, 1, InStr(wb.Name, ".xls") - 1))
If i = 1 And i <= 25 Then
Sheet1.Cells(5 + i - 1, 1).Value = i
End If
End If
Next wb

HTH

Alok Joshi

"lawson" wrote:

hi back!

no, i dont want it to record the names. i want it to count the spreadsheets
if and only if they're names are 1.xls, 2.xls...25.xls, then enter the values
1 through n in (what i should have typed the first time) a5:a:30. if there
are only 5 spreadsheets open (ie 1.xls, 2.xls...5.xls) then it starts in a5
and enters 1, 2 in a6,...5 in a9

thanks a million

"Alok" wrote:

Hi,

Just need some clarifications to answer your question. Do you mean that the
code should record the names of all the open workbooks in A5:A25? Are they
named 1.xls, 2.xls etc? Also you probably meant A1:A25 if all 25 were open
and their names had to be recorded?

Alok

"lawson" wrote:

Hello

i have a spreadsheet that upon opening, it counts all the spreadsheets (n)
that are also open and are named inclusively between 1 and 25. it then enters
the values 1, 2, 3....n in column A5:A25.

thanks

Lawson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting Cells in a column depending on another column but excluding duplicates rwenger Excel Discussion (Misc queries) 0 April 11th 10 01:06 PM
Counting items in one column based on criteria in another column luttona Excel Worksheet Functions 3 June 13th 08 06:00 PM
Counting entries in column based on condition in another column RobertR Excel Worksheet Functions 1 February 8th 07 03:54 PM
Formula help for counting,with a column of dates and a column of n Altstatten Excel Worksheet Functions 2 December 8th 05 09:32 PM
Counting names in a column but counting duplicate names once TBoe Excel Discussion (Misc queries) 9 May 11th 05 11:24 PM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"