Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Replace a value in a cell of a row - Idiot Proofing Forms Series

0

Hello,

First, your 'idiot proofing forms' series was fantastic! I used that series to create a checkbook register that acts like a form. In the 8th episode of the series is a series of steps to lookup a row in a data table and delete the row. Instead of deleting the row I would like to change the value in a cell in that row to "void".

The command in particular I am using is:

Set Rng = TransIdCol.Find(What:=SearchValue, _

            LookIn:=xlValues, _

            LookAt:=xlWhole, _

            SearchOrder:=xlByRows, _

            MatchCase:=False)

        If Not Rng Is Nothing Then

        Rng.EntireRow.Delete

Instead of deleting the row, I would like to change the contents of cell in column I of that row to "void". I've tried several other comands and am struggling to find the one that works.

Thanks in advance and thanks again for the tutorial!

Answer
Discuss

Answers

0

I'm glad you like it!

Try changing Rng.EntireRow.Delete to Rng.Value = "Void"

I haven't looked at the code for a while but it looks like that should work.

Discuss

Discussion

Thanks for the reply. That puts 'void' in the id column. I want to put 'void' in a different cell in the row.
pcholka Jan 27, '22 at 10:02 am
Don't know this course but you can use:
Rng.Offset(0,2).Value = "Void"
changing the 2 to be the required number of columns to the right of current position it occupies.
John_Ru (rep: 6152) Jan 27, '22 at 2:31 pm
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login