mysql - excel vba - add table column with date based on adjacent cell that includes date and time -
i have excel table ("table1") 4 total columns. 3rd , 4th column contain 'clock in' , 'clock out' information formatted show date , time. example :
6/3/2016 10:54:52
i 2 things here...first, want create new, 3rd column reads date, formatted "d-mmm". should match date found in column 4.
the second thing take date portion of text out of columns 4 , 5. @ end, example row of data might read follows (columns 3:5):
c, d, e 7-jun, 10:54:52 am, 4:59:44
here have far code:
sub test() dim currentsht worksheet dim lst listobject set curretnsht = activeworkbook.sheets(1) set lst = currentsht.listobjects("table1") lst.listcolumns.add position:=3 'not sure how rest end sub
that's not excel way. dates numbers 0 represents 1/1/1900. add 1 , next day value of hour 1/24 .
biggest problem of approach excel stop editing cell excel evaluate cells value. it'll still 7 - jun excel changes cells format , cells value 7 - jun of 6/7/216. it's best have cells equal same date. change cells formatting display results want. if need calculate month use worksheet function so. =month(a1)
Comments
Post a Comment