Not sure what is happening: When trying to load previous data it clears it instead of loading VBA.

abi_321

New Member
Joined
Nov 16, 2022
Messages
15
Office Version
  1. 2021
Platform
  1. Windows
Hi all,

So when I input a previous PO number under PO# (Circled in red) I want it to pull all my data through into the correct cells from my data base on sheet 2 'PO List'.

Everything is working Supplier, Reference, Description etc.... bar the delivery address where instead of inputting the data into the cells (F9 & F10), it clears it from the database on sheet 2.



1669041341801.png


1669041388104.png


Please see the code below:


Sub PO_SaveUpdate()
Dim PORow As Long, POItemRow As Long, LastItemRow As Long, ItemRow As Long
With Sheet1
'Determine if New or Existing PO
If .Range("B5").Value = True Then 'New
PORow = Sheet2.Range("A99999").End(xlUp).Row + 1 'First AvailRow
.Range("H3").Value = .Range("B7").Value 'Next PO #
Sheet2.Range("A" & PORow).Value = .Range("H3").Value 'PO#
Else 'Existing PO
PORow = .Range("B4").Value 'Purchase Order Row
End If
Sheet2.Range("B" & PORow).Value = .Range("H4").Value 'PO Date
Sheet2.Range("C" & PORow).Value = .Range("H5").Value 'Status
Sheet2.Range("D" & PORow).Value = .Range("D9").Value 'Vendor
Sheet2.Range("E" & PORow).Value = .Range("F9").Value 'Del.Add1
Sheet2.Range("F" & PORow).Value = .Range("F10").Value 'Del.Add2

thanks for your help in advance.

Abi :)
 

Attachments

  • 1669038860738.png
    1669038860738.png
    24.7 KB · Views: 6
  • 1669041322243.png
    1669041322243.png
    23.6 KB · Views: 8

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You appear to be using the value in B4 as ROW number in sheet2 , while you appear to have labeled it as PO number
VBA Code:
PORow = .Range("B4").Value 'Purchase Order Row
This doesn't look as though it is correct, so I think you find the row withthat PO, use VBA, Find, Match whatever method you want
 
Upvote 0
You appear to be using the value in B4 as ROW number in sheet2 , while you appear to have labeled it as PO number
VBA Code:
PORow = .Range("B4").Value 'Purchase Order Row
This doesn't look as though it is correct, so I think you find the row withthat PO, use VBA, Find, Match whatever method you want

Hi Thank you for your feedback, this does not seem to have fixed it.

Everything is pulling through fine like 'PODate,'Status and 'Vendor' bar the Delivery address where it is clearing it rather than adding the information in.
 
Upvote 0
I think you need to describe in more detail what you are trying to do, ( because your code is not clear) :
Which cell do you enter the PO number??
What is supposed to happen if you enter a PO number which exists
what is supposed to happen if you enter a PO number which doesn't exist
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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