Possible ActiveWorkbook.AcceptAllChanges/.Save Problem

basicallyawesome

New Member
Joined
Jul 10, 2018
Messages
29
Office Version
  1. 365
I’m not sure if I have a problem here. It’s not bringing up an error code so it may be behaving as expected, I’m not entirely sure. I created two multipage forms after being encouraged to use them to fix one problem, I started with one from the getgo in this other project. It works perfectly except...

I’m running a shared workbook, I know this is not ideal but don’t have access to Access or other more robust software. Excel is as good as it gets. So I needed a way for it to check for the next blank row before inputting data since more than one user may be in it at any given time.

So this is what I’m using:
Private Sub Submit_Click()
’Accept all changes and find last row
ActiveWorkbook.AcceptAllChanges
ActiveWorkbook.Save

It seems to work, except that when I tested it with sharing turned on, but being the only one in it, it deposits my info on the second blank row. So for example

Row1 - Header row
Row2 - Blank
Row3 - First record
Row4 - Second record

If I start with data already in the sheet it behaves similarly:
Row1 - Header row
Row2 - First record
Row3 - Second record
Row4 - Third record
Row5 - Blank
Row6 - New Data

Without the above code, it puts the data in the first row after the header. Is this to be expected from the code I’m using? Will the above code do what I need it to do when it’s more than just me in the spreadsheet? Is there a way to fix it?

Thank you!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
are you using

Code:
LastRowNo = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
LastColNo = Worksheets("Sheet1").Cells(2, Columns.Count).End(xlToLeft).Column
 
Upvote 0
are you using

Code:
LastRowNo = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
LastColNo = Worksheets("Sheet1").Cells(2, Columns.Count).End(xlToLeft).Column

Not currently, but I tried that earlier in the day and it resulted in an Error 1004?
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,239
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top