Diane Lonergan
asked on
Excel VB to change the value of a cell dependent upon the value of another
I originally posted this as an Excel formula request to see if there was a clever way round without vb, but I don't think it's possible. VBA seems my best bet.
I want to change the contents of a cell depending upon a comparison test, this basically what I am wanting to achieve
if a2=b3 then make j2=g3 otherwise do nothing.
I will actually have a series of these to check (see my attached file). This spreadsheet details what I want to ultimately achieve, but just the above element of it would be a tremendous help
sample-data-for-experts-exc.xlsx
I want to change the contents of a cell depending upon a comparison test, this basically what I am wanting to achieve
if a2=b3 then make j2=g3 otherwise do nothing.
I will actually have a series of these to check (see my attached file). This spreadsheet details what I want to ultimately achieve, but just the above element of it would be a tremendous help
sample-data-for-experts-exc.xlsx
Are you wanting this to happen as a user enters data into the sheet changing those cells or as one of run over it or button someone presses?
Cell checks or amendments are easy enough - I'm using phone at moment so bit looked at your sheet but can be as simple as
if range ("A1").value=range ("A2").value then range ("B1")=range ("A1").value
etc. you could trigger the VBA when a specific cell or range of cells is changed or being run by button, sheet being saved or whatever us required.
Will look back when on Pc later.
Steve
Cell checks or amendments are easy enough - I'm using phone at moment so bit looked at your sheet but can be as simple as
if range ("A1").value=range ("A2").value then range ("B1")=range ("A1").value
etc. you could trigger the VBA when a specific cell or range of cells is changed or being run by button, sheet being saved or whatever us required.
Will look back when on Pc later.
Steve
ASKER
Hi Subodh
I have attempted to illustrate a little better. I hope it makes sense. Thanks
sample-data-for-experts-exc.xlsx
I have attempted to illustrate a little better. I hope it makes sense. Thanks
sample-data-for-experts-exc.xlsx
ASKER
Hi Steve
The data will be extracted from another source and pasted into the spreadsheet. The VB would then be executed to run through the spreadsheet and produce the desired results.
Thanks
The data will be extracted from another source and pasted into the spreadsheet. The VB would then be executed to run through the spreadsheet and produce the desired results.
Thanks
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Subodh
That's perfect thank you so much. You scored a hole in one.
That's perfect thank you so much. You scored a hole in one.
You're welcome Diane! Glad to help.
ASKER
This was very fast and very helpful
Thanks for the feedback.
Would you please just populate the rows (after removing the comments from there) as per your logic and then explain the logic behind each row you populated on the sheet?