I want to check sheet exist
if have sheet1 and sheet2 copy column A-C
merge 2 sheet to 1 datatable and sort column Planned End (ascending) —> append data to file summary sheet Summary1.
if have sheet1 only copy column A-C ------> append data to file summary sheet Summary1.
if have sheet2 only copy column A-C ------> append data to file summary sheet Summary1.
if don’t have sheet1 or sheet2 -----> end
Please guide me for solve it.
File as attached.
Summary.xlsx (9.5 KB)
input (1).xlsx (11.7 KB)
Expect output = file summary sheet Expect_output
Pease guide me for solve it.
Thsnk you.
Can guide me for solve it.
Thank you.
Yoichi
(Yoichi)
March 19, 2024, 2:56am
3
HI,
How about the following sample?
Sample
Sample20240319-2 (2).zip (19.5 KB)
Regards,
@Yoichi I want copy data from column A-C only.
and write range workbook I want tot write in append row ( can’t fix A3)
Please guide me about it.
Thank you
Yoichi
(Yoichi)
March 19, 2024, 3:13am
5
HI,
Can you try the following?
dtResult.DefaultView.ToTable(False,{"Status","Owner","Planned End"}).AsEnumerable.OrderBy(Function(r) CDate(r("Planned End"))).CopyToDataTable
Sample20240319-2 (3).zip (19.6 KB)
Regards,
@Yoichi I have a question in append range.
If I don’t use column name because real data have 20 column.
Do you have idea for use column A-T don’t use column name?
Yoichi
(Yoichi)
March 19, 2024, 3:20am
7
Give it a try the following expression. This filters the first 20 columns.
dtResult.DefaultView.ToTable(False,dtResult.Columns.Cast(Of DataColumn).Take(20).Select(Function(dc) dc.ColumnName).ToArray()).AsEnumerable.OrderBy(Function(r) CDate(r("Planned End"))).CopyToDataTable
Regards,
@Yoichi now use if inside if.
It can modify to use switch case or not.
Please guide me for solve it.
Thank you.
Yoichi
(Yoichi)
March 19, 2024, 4:36am
9
In this case, we can write multiple IF activities flatly as the following. How about this?
Sample
Sample20240319-2 (5).zip (19.6 KB)
Regards,