Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Counting Cells in a column depending on another column but excluding duplicates | Excel Discussion (Misc queries) | |||
Counting items in one column based on criteria in another column | Excel Worksheet Functions | |||
Counting entries in column based on condition in another column | Excel Worksheet Functions | |||
Formula help for counting,with a column of dates and a column of n | Excel Worksheet Functions | |||
Counting names in a column but counting duplicate names once | Excel Discussion (Misc queries) |