Re: Fwd: [libreoffice-users] macro to only change month

2018-01-28 Thread Johnny Rosenberg
I just realised that MyDateSerial doesn't work when lMonth is negative, since, for instance, Int(-2.5) returns -3 and not -2, so here's a new version of the workaround that hopefully fixes that: Option Explicit Public Function MyDateSerial(lYear As Long, lMonth As Long, lDay As Long) As Date

Re: Fwd: [libreoffice-users] macro to only change month

2018-01-28 Thread Johnny Rosenberg
Just for fun, here's a workaround for the DateSerial issue in LibreOffice Basic (the fact that things like DateSerial(2018,13,59) isn't allowed. I am at work so I could only test this in Excel (in which the function isn't needed anyway), but it should work in LibreOffice Calc as well: REM * BA

Re: [libreoffice-users] macro to only change month

2018-01-28 Thread Johnny Rosenberg
2018-01-28 17:01 GMT+01:00 Luuk : > > On 28-01-18 16:30, Johnny Rosenberg wrote: > > 2018-01-28 15:45 GMT+01:00 Luuk > >: > > > > You can write a FUNCTION to get next month > > > > Function FirstOfNextMonth(dDate as Date) as Date > > if Month(dDate)>=12 th

Re: [libreoffice-users] macro to only change month

2018-01-28 Thread Tom Davies
Hi :) This sort of thing might be better as a database. The advantage being that you wouldn't need a new page for each month = you just keep entering data in the same place. The page(s) for a 'month' would be a "Query". You could have extra queries to cover different or/and changeable time-frame

Re: [libreoffice-users] macro to only change month

2018-01-28 Thread Luuk
On 28-01-18 16:30, Johnny Rosenberg wrote: > 2018-01-28 15:45 GMT+01:00 Luuk >: > > You can write a FUNCTION to get next month > > Function FirstOfNextMonth(dDate as Date) as Date >     if Month(dDate)>=12 then >         FirstOfNextMonth = DateSerial(Year(

Re: [libreoffice-users] macro to only change month

2018-01-28 Thread Johnny Rosenberg
2018-01-28 15:45 GMT+01:00 Luuk : > You can write a FUNCTION to get next month > > Function FirstOfNextMonth(dDate as Date) as Date > if Month(dDate)>=12 then > FirstOfNextMonth = DateSerial(Year(dDate)+1, 1, 1) > else > FirstOfNextMonth = DateSerial(Year(dDate), Month(dDat

Re: [libreoffice-users] macro to only change month

2018-01-28 Thread Luuk
You can write a FUNCTION to get next month Function FirstOfNextMonth(dDate as Date) as Date     if Month(dDate)>=12 then         FirstOfNextMonth = DateSerial(Year(dDate)+1, 1, 1)     else         FirstOfNextMonth = DateSerial(Year(dDate), Month(dDate)+1, 1)     end if End Function When you use

Re: Fwd: [libreoffice-users] macro to only change month

2018-01-28 Thread Brian Barker
At 12:40 28/01/2018 +0100, Johnny Rosenberg wrote: 2018-01-28 9:04 GMT+01:00 Brian Barker: Does =DATE(2017;13;59) not give 2018-02-28 for you? Yes, it does. I was referring to the Basic function DateSerial ... Whoops: sorry! Brian Barker -- To unsubscribe e-mail to: users+unsubscr...@gl

Re: Fwd: [libreoffice-users] macro to only change month

2018-01-28 Thread Johnny Rosenberg
2018-01-28 9:04 GMT+01:00 Brian Barker : > At 08:52 28/01/2018 +0100, Johnny Rosenberg wrote: > >> For some strange reason you need to make sure you enter valid values for >> month and day. In Excel (which sucks in most aspects, but I have to use it >> at work) you can do things like DateSerial(20

Re: Fwd: [libreoffice-users] macro to only change month

2018-01-28 Thread Brian Barker
At 08:52 28/01/2018 +0100, Johnny Rosenberg wrote: For some strange reason you need to make sure you enter valid values for month and day. In Excel (which sucks in most aspects, but I have to use it at work) you can do things like DateSerial(2017, 13, 59), which returns the date value for 201

Fwd: [libreoffice-users] macro to only change month

2018-01-27 Thread Johnny Rosenberg
As usual I accidently sent my reply to the OP directly rather than to the list, and once again I'm sorry for that. Here's what I replied: -- Forwarded message -- From: Johnny Rosenberg Date: 2018-01-28 0:48 GMT+01:00 Subject: Re: [libreoffice-users] macro to only chang

Re: [libreoffice-users] macro to only change month

2018-01-27 Thread Brian Barker
At 14:26 27/01/2018 -0700, B J Lockie wrote: I keep a spreadsheet with a monthly budget. Each month I copy a month to make a new month. I use Fill to change the dates to the new month. This is not ideal because sometimes there are 2 rows for the same day and Fill changes the 2nd day. I need a m

[libreoffice-users] macro to only change month

2018-01-27 Thread bjlockie
I keep a spreadsheet with a monthly budget. Each month I copy a month to make a new month. I use Fill to change the dates to the new month. This is not ideal because sometimes there are 2 rows for the same day and Fill changes the 2nd day. I need a macro just to change the month and not the day.