Hi,
I am new to this forum and very new to VBA. I would be really great full if anyone could help on this please.
I have a journal data file that I want to validate using VBA and once the validations have been checked, to create a .csv file from the data file to post as a journal into an application.
The data has been shown below in the table as I didn't know how to attach my file as couldn't find the attach button.
VBA Required:
1. What I am after is if Column A is 1 then do a check that for the same row which is 1 that Column J - Column I = 0. So what I am trying to do here is if A1=1 and I1-J1=0 then give me a message stating 'all is good', otherwise give me a message stating 'all is bad', but when I1-J1 does not =0, I want to write the cell addresses of all bad rows into another spreadsheet in the same file. I want this to work for all columns and rows which have column A as 1.
2. VBA to check that if Column A is 1 then Column M can only be either T or F, if column A is 1 then Column N can only be L or G, if column A is 1 then column G can only be LC
3. VBA to check that if column A is 2, then check to see that data in columns H and I is to 0 decimal places, if not to convert all data in columns H and I to 0 decimal places where column A is 2
4. VBA to alert the user when column A is 2 and column D is 17100 and a popup message stating 'Please provide further information'
5. Once all the validations have been met, a popup message stating 'All data has been validated - create .CSV file?' Yes/No button if user clicks yes it gives the user a screen where they can save the file as .csv format, if user clicks no, then nothing happens and user returns to the file.
I would really be greatful if the VBA can be anotated, so I can learn how things are actually happening.
Any assistance will be greatly appreciated.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]AC[/TD]
[TD]LJ[/TD]
[TD]1503[/TD]
[TD]0[/TD]
[TD]LC[/TD]
[TD]Jrnl Description[/TD]
[TD]100000[/TD]
[TD]100000[/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]F[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]72400[/TD]
[TD]UKGB[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]UKGB[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD]50000[/TD]
[TD][/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]USAM[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]17100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]25000[/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]AC[/TD]
[TD]LJ[/TD]
[TD]1504[/TD]
[TD]0[/TD]
[TD]LC[/TD]
[TD]Jrnl Description[/TD]
[TD]150000[/TD]
[TD]150000[/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]F[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]72400[/TD]
[TD]UKGB[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]USAM[/TD]
[TD]FTOF[/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]EUEU[/TD]
[TD]FTOF[/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]17100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]100000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
I am new to this forum and very new to VBA. I would be really great full if anyone could help on this please.
I have a journal data file that I want to validate using VBA and once the validations have been checked, to create a .csv file from the data file to post as a journal into an application.
The data has been shown below in the table as I didn't know how to attach my file as couldn't find the attach button.
VBA Required:
1. What I am after is if Column A is 1 then do a check that for the same row which is 1 that Column J - Column I = 0. So what I am trying to do here is if A1=1 and I1-J1=0 then give me a message stating 'all is good', otherwise give me a message stating 'all is bad', but when I1-J1 does not =0, I want to write the cell addresses of all bad rows into another spreadsheet in the same file. I want this to work for all columns and rows which have column A as 1.
2. VBA to check that if Column A is 1 then Column M can only be either T or F, if column A is 1 then Column N can only be L or G, if column A is 1 then column G can only be LC
3. VBA to check that if column A is 2, then check to see that data in columns H and I is to 0 decimal places, if not to convert all data in columns H and I to 0 decimal places where column A is 2
4. VBA to alert the user when column A is 2 and column D is 17100 and a popup message stating 'Please provide further information'
5. Once all the validations have been met, a popup message stating 'All data has been validated - create .CSV file?' Yes/No button if user clicks yes it gives the user a screen where they can save the file as .csv format, if user clicks no, then nothing happens and user returns to the file.
I would really be greatful if the VBA can be anotated, so I can learn how things are actually happening.
Any assistance will be greatly appreciated.
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD]G[/TD]
[TD]H[/TD]
[TD]I[/TD]
[TD]J[/TD]
[TD]K[/TD]
[TD]L[/TD]
[TD]M[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]AC[/TD]
[TD]LJ[/TD]
[TD]1503[/TD]
[TD]0[/TD]
[TD]LC[/TD]
[TD]Jrnl Description[/TD]
[TD]100000[/TD]
[TD]100000[/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]F[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]72400[/TD]
[TD]UKGB[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]UKGB[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD]50000[/TD]
[TD][/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]USAM[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]17100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]25000[/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]AC[/TD]
[TD]LJ[/TD]
[TD]1504[/TD]
[TD]0[/TD]
[TD]LC[/TD]
[TD]Jrnl Description[/TD]
[TD]150000[/TD]
[TD]150000[/TD]
[TD][/TD]
[TD]Y[/TD]
[TD]F[/TD]
[TD]L[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]72400[/TD]
[TD]UKGB[/TD]
[TD]HDOF[/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]USAM[/TD]
[TD]FTOF[/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]78030[/TD]
[TD]EUEU[/TD]
[TD]FTOF[/TD]
[TD][/TD]
[TD]25000[/TD]
[TD][/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]17100[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]100000[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]13[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD]11035[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]14[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]10002[/TD]
[TD]28200[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]50000[/TD]
[TD]14080[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]