Thanks in advance for any help!
I am trying to create a vba code that will do 2 things. I need the columns to auto fit after data entry and a time stamp in the previous column from the location when the data is entered. I attached the file.
Thanks in advance for any help!
I am trying to create a vba code that will do 2 things. I need the columns to auto fit after data entry and a time stamp in the previous column from the location when the data is entered. I attached the file.
Hi there,
place this in WorkSheet_Change event:
or here is Your sample:Please Login or Register to view this content.
officer tracking.xlsm
Does this solution match Your requirements?
Regards
Miroslav R.
(If You like my solutions, feel free to add reputation.)
What does "IF" part of code do here. When i use this part of code alonei get a 1004 error. Just curious as to how it works.ThanksPlease Login or Register to view this content.
Hi there,
It is because this code is assigned to Worksheet_Change event. I words:
If You enter something in cell A4, then timestamp should be recorded to cell A3. But recording timestamp to A3 triggers another change event, and if
stands alone (without IF), the code records another timestamp in A3-1 = A2. Then another change event with timestamp to A1 and finaly You do not have cell A0... And this is Your 1004 error.Please Login or Register to view this content.
So You have to use IF to stop all that triggering after 1st timestamp. The IF says to excel change event, that only if value is entered in column which can be divided by 2 without any rest, record timestamp to cell on the left. And this only for column with number 4 and higher.
Is it understandable?
Thank you so much.. if i use the IF part without -2i feel it works in same way. Is it correct?Please Login or Register to view this content.
Also am new to macro and interested in programming. I just browse through forums and look at solutions provided by you guys. How come you come with these kind of beautiful solutions. Does it come with practise or does it need extra grey matter which am not if i have
Hi there,
without '-2' it will work in the same way... It is a rest from my testing...
BUT when I look at that now, better You add new condition for IF and finaly the IF row has to look like:
because when You write something to col B, it should not write timestamp in col A.Please Login or Register to view this content.
Pls rewrite that line in Your workbook.
Yes fine i would take it and you did not answer my second part of question. Not sure if its allowed here though
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks