ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Returning a list names from a schedule (https://www.excelbanter.com/excel-programming/373649-returning-list-names-schedule.html)

Zb Kornecki

Returning a list names from a schedule
 
Hi, I'm working on schedule program for work where I Employee_Name in column
A and Date in row 1. the table then gets filled in with a symbol for the
shift worked or is left blank. I am trying to create a list of the eployees
working each day (i.e. Cell value not blank)

I tried doing a ForEach loop but was obviouly not getting it right. Any
suggestions/comments would be appriciated

Thanbks
Zb Kornecki

Tom Ogilvy

Returning a list names from a schedule
 
Maybe something like this untested pseudocode.

Sub GenerateList()
dim rw as Long, rng as Range, cell as Range
dim rng1 as Range, cell1 as Range
Dim sh as Worksheet
Dim rw = 2
set sh = worksheets("Schedule")
set sh1 = Worksheets("List")
sh1.Range("A1:C1") = Array("Name","Date","Symbol")
set rng = sh.Range(sh.cells(2,1),sh.cells(2,1).End(xldown))
for each cell in rng
if application.CountA(cell.Entirerow) 1 then
set rng1 = sh.range(cell.offset(0,1),sh.Cells(cell.row,"IV"). End(xltoLeft))

for each cell1 in rng1
if cell1 < "" then
with sh1
cells(rw,1).Value = cell.Value
cells(rw,2).Value = cells(1,cell.column).Value
cells(rw,3).Value = cell1.value
rw = rw + 1
end if
end if
Next
End sub

--
Regards,
Tom Ogilvy



"Zb Kornecki" wrote:

Hi, I'm working on schedule program for work where I Employee_Name in column
A and Date in row 1. the table then gets filled in with a symbol for the
shift worked or is left blank. I am trying to create a list of the eployees
working each day (i.e. Cell value not blank)

I tried doing a ForEach loop but was obviouly not getting it right. Any
suggestions/comments would be appriciated

Thanbks
Zb Kornecki


Zb Kornecki

Returning a list names from a schedule
 
Thank you I'll work w/ this and see how it works Zb

"Tom Ogilvy" wrote:

Maybe something like this untested pseudocode.

Sub GenerateList()
dim rw as Long, rng as Range, cell as Range
dim rng1 as Range, cell1 as Range
Dim sh as Worksheet
Dim rw = 2
set sh = worksheets("Schedule")
set sh1 = Worksheets("List")
sh1.Range("A1:C1") = Array("Name","Date","Symbol")
set rng = sh.Range(sh.cells(2,1),sh.cells(2,1).End(xldown))
for each cell in rng
if application.CountA(cell.Entirerow) 1 then
set rng1 = sh.range(cell.offset(0,1),sh.Cells(cell.row,"IV"). End(xltoLeft))

for each cell1 in rng1
if cell1 < "" then
with sh1
cells(rw,1).Value = cell.Value
cells(rw,2).Value = cells(1,cell.column).Value
cells(rw,3).Value = cell1.value
rw = rw + 1
end if
end if
Next
End sub

--
Regards,
Tom Ogilvy



"Zb Kornecki" wrote:

Hi, I'm working on schedule program for work where I Employee_Name in column
A and Date in row 1. the table then gets filled in with a symbol for the
shift worked or is left blank. I am trying to create a list of the eployees
working each day (i.e. Cell value not blank)

I tried doing a ForEach loop but was obviouly not getting it right. Any
suggestions/comments would be appriciated

Thanbks
Zb Kornecki



All times are GMT +1. The time now is 06:25 PM.

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