Auto date entry formula - Microsoft Community


hi  want automatically enter days date dates column, provided item has been entered sale on day. if customer orders 3 items column dates should populate row cells days date. don't want users enter date transactions themselves. sample data table blow showing end rows sample item column has no data formula ignores populate if there item on first column. thank reading

item quantity price amount paid  balance date personnel
sample 1 17 ghc10.00 ghc170.00 ghc180.00 -ghc10.00 18/07/2017 lamin
sample 2 4 ghc10.00 ghc40.00 ghc30.00 ghc10.00 18/07/2017 lamin
sample 13 17 ghc10.00 ghc170.00 ghc170.00 ghc0.00 19/07/2017 lamin
sample 3 5 ghc10.00 ghc50.00 ghc50.00 ghc0.00 19/07/2017 lamin
sample 4 6 ghc10.00 ghc60.00 ghc70.00 -ghc10.00 19/07/2017 lamin
sample 6 1 ghc10.00 ghc10.00 ghc10.00 ghc0.00 20/07/2017 lamin
sample 5 7 ghc10.00 ghc70.00 ghc70.00 ghc0.00 20/07/2017 lamin
sample 5 10 ghc10.00 ghc100.00 ghc100.00 ghc0.00 20/07/2017 lamin
15 #value! ghc150.00 #value! lamin
12 #value! ghc15.00 #value! lamin
3 #value! ghc15.00 #value! lamin
4 #value! ghc15.00 #value! lamin
5 #value! ghc15.00 #value! lamin
8 #value! ghc15.00 #value! lamin
sample 1 7 ghc10.00 ghc70.00 ghc45.00 ghc25.00 18/07/2017  
 
 
 

right-click sheet tab.

select "view code" context menu.

copy following code worksheet module:

private sub worksheet_change(byval target range)
    dim cel range
    if not intersect(range("a2:a" & rows.count), target) nothing then
        application.screenupdating = false
        application.enableevents = false
        each cel in intersect(range("a2:a" & rows.count), target)
            if cel.value = "" then
                cel.offset(0, 6).clearcontents
            else
                cel.offset(0, 6).value = date
            end if
        next cel
        application.enableevents = true
        application.screenupdating = true
    end if
end sub

switch excel.

save workbook macro-enabled workbook.

make sure users enable macros when open workbook.



Office / Excel / Microsoft Office Programming



Comments

Popular posts from this blog

Getting ErrorCode: 120018 when trying to access Microsoft account - Microsoft Community

The message was sent to a distribution list ‎(DL)‎ - Microsoft Community

Activation Error 0x8004FE93 - Microsoft Community