![]() |
#1
|
|||
|
|||
![]()
One of the contributors here wrote a VBA code for me some time ago (see attached).
The spreadsheet is an annual record of expenditure, so in a new year, I clear all the data and save the old file (****_2022) as the new file (****_2023). It selects s starting value in a column (fixed) and also the final value in that column (this is variable) For some reason, the second part (get the last record in a column) is no longer working. In fact, the relevant field on the sheet now states "=Current!E1004", which was the last record in that column on last year's spreadsheet. This has only happened since I saved as a new file. The macro is saved in personal.xlsb I was not sure if I could post code directly here, so the code is attached. Tommy |
#2
|
||||
|
||||
![]()
try changing to:
Code:
.Range("T15").Formula = "=Current!E" & Worksheets("Current").Cells(Rows.Count, "E").End(xlUp).Row |
#3
|
|||
|
|||
![]()
Thanks p45cal
That has worked perfectly Can you explain the change so that I can learn. Tommy |
#4
|
||||
|
||||
![]()
.UsedRange sometimes doesn't update properly.
.Cells(Rows.Count, "E").End(xlUp).Row does the equivalent you selecting the bottomost cell in column E (probably E1048576) then on the keyboard tapping End then the up arrow. |
#5
|
|||
|
|||
![]()
Thanks for the support p45cal
|
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macros Issue | ziggy3822 | Project | 0 | 05-04-2018 08:32 AM |
PDF Conversion Issue - Background Tiled Image Size Issue | dustpie | Word | 1 | 10-23-2016 07:33 PM |
Is this a PowerPoint issue or a Mac issue? | Brian_V | PowerPoint | 0 | 05-14-2015 09:19 AM |
csv issue | QCHA | Mail Merge | 9 | 10-30-2014 04:40 AM |
New Issue | jantoine | Outlook | 1 | 09-28-2010 06:08 PM |