PDA

View Full Version : Adjusting VBA module



joeny0706
09-17-2021, 08:16 AM
Hi All
I have raw data that I convert into a format I can upload into my accounting program.

I have a xlsm file with 7 modules or so. One of these modules calculates discount. It takes the price in the raw data and compares it to a price listed on a xlsx file. If that price is lower it will calculate the discount them make a new discount line with that value. We are changing our prices for some of the customers. It is going up of course. Since it is only changing for some customers it is causing a problem. Currently if the price in the raw data sold price is more than the price of the item “price listed in xlsx file” it replaces the higher price with the correct price. Since that price increase, I need a change I was hoping someone can help me with. If the price is higher than the correct price “listed in the xlsx file” I now need it to leave that price alone. “Not change it to match the correct price”. Would anyone have time to take a look and see if it is just a quick fix.

I have two xlsm files. One for credits and one for invoices. I need the same done to both.
I have attached both xlsm files I use to convert the data, the xlsx files the xlsm use to do conversion and a file showing raw data, current conversion and how I need the conversion outcome to look.

joeny0706
09-17-2021, 11:57 AM
I have figured out how to fix the problem I explained in the first post. Now I need help with another.
The xlsm file needs a module that will remove lines. I will have an excel file attached that shows if the invoices have been signed. There is a column for signature status. I need all invoices with a false for signature to be removed when I do the converting with the xlsm file. I have attached the file I will get each week that shows signature status.
If a module could find all invoice numbers with a false under signature and remove them when using the invoice xlsm file to do the converting.

Paul_Hossler
09-18-2021, 12:42 AM
Try



Sub Macro1()
With ActiveSheet.Columns(4)
.Replace What:="FALSE", Replacement:="=1/0", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False, FormulaVersion:=xlReplaceFormula2
On Error Resume Next
.SpecialCells(xlCellTypeFormulas, 16).EntireRow.Delete
On Error GoTo 0
End With
End Sub

joeny0706
09-21-2021, 07:24 AM
Thanks I need to do a better job explaining.

I use the xlsm file to convert all the raw data. Once that is converted I have a xls file that needs to be compared and any invoices that are in the xls file with false need to be removed out of the xlsm file. Would be nice so I can do all the converting and removing of invoices that are in the xls file at the same time. If I had a module that does the comparing and removing so I could just add that within the xlsm file. If I have to do it separately that would be ok. I have attached the xlsm file and also the xls file that will show what invoices need to be removed "any with false in column D".

Attached is the xlsm file blank, xlsm file with raw data and the xlsm file after the conversion.
I also attached the xls file that will be used to compare to the xlsm file and need those invoices removed from the xlsm file. All invoices with false in column D need to be removed from the xlsm file. Best would be to have the false invoices removed after the data is converted.

If I did not explain that good enough let me know


Thanks all for help. This is stopping me from being able to upload my invoices into the accounting program.

joeny0706
09-21-2021, 07:26 AM
Paul
Thanks for Help and all help in the past. You also helped me create the xlsm file.