Hi all. Hope you guys can help me out.
Got a VBA process which imports data from a web page and clears cells where the value is less than 0. This works fine so the result is like below. Data in cells A4:C15
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]114[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]114[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]114[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The next step is to populate the cells which have been cleared with a value from another table/area in the same worksheet. The table below is in B34:C37. The value in column 2 can change on a daily basis so I can't hard-code a value.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]114[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]400[/TD]
[/TR]
</tbody>[/TABLE]
I've looked around the web and I think I can should be using a loop to go through a range, ignore the cells with a 0 but if the cell is empty I then need to populate it with the appropriate value e.g. the black cell which has 114 would be updated with 100, the blank cell with 125 would be populated with 200 and so on. I think WorksheetFunction.VLookup is what I need or a possible solution but this is above my current knowledge/expertise.
Advice and hopefully a solution would be appreciated.
Thanks
Got a VBA process which imports data from a web page and clears cells where the value is less than 0. This works fine so the result is like below. Data in cells A4:C15
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]114[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]114[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]114[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]sev1[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]sev2[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]sev3[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The next step is to populate the cells which have been cleared with a value from another table/area in the same worksheet. The table below is in B34:C37. The value in column 2 can change on a daily basis so I can't hard-code a value.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]114[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]137[/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]148[/TD]
[TD]400[/TD]
[/TR]
</tbody>[/TABLE]
I've looked around the web and I think I can should be using a loop to go through a range, ignore the cells with a 0 but if the cell is empty I then need to populate it with the appropriate value e.g. the black cell which has 114 would be updated with 100, the blank cell with 125 would be populated with 200 and so on. I think WorksheetFunction.VLookup is what I need or a possible solution but this is above my current knowledge/expertise.
Advice and hopefully a solution would be appreciated.
Thanks