VBA - IF statement based on VLOOKUP

SORD

New Member
Joined
Feb 19, 2025
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I am trying to automate my first VBA macro. It is the printing of the current sheet (SHEET2) based on a VLOOKUP value on another sheet (SHEET1). If the value is 0 then move to the next record on SHEET1 until no more records. I can perform the lookup no problem but then I am having trouble formatting the IF statement.
SHEET2 is an empty form that would be populated with data calculated based on the returned value from SHEET1
Can anyone assist me?
 
You need to provide the details about what is the VLOOKUP you want to do.

Also, it might be better to use the built-in VBA Find method instead of a worksheet function to do what you want to do. We need to understand your objective, not how you are expecting that it would be done.

What is the value on Sheet2 that you want to look for?
What is the range on Sheet1 where you want to look for it?
What is the corresponding range on Sheet1 that you want the retrieve the resulting value from?

Please show your existing VBA code so we can show where where to update it. I recommend pasting the code into your post, selecting it, then clicking the "VBA" button to add code tags.
 
Upvote 0

Forum statistics

Threads
1,226,837
Messages
6,193,254
Members
453,784
Latest member
Chandni

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top