IF function in VBA

Meko1

New Member
Joined
Oct 20, 2020
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
Hello
I would like help in converting if function into VBA code.

So, first I want to use 2 sheets in my excel for the code, first ActiveSheet, which needs to receive data from Sheet10 or ("Whole info") sheet.
Ok so there are 4 if functions:

ActiveSheet B22=IF('Whole info'!N2>0,50%,0%),
ActiveSheet B23=IF('Whole info'!M2>0,10%,0%),
ActiveSheet B24=IF(OR('Whole info'!J2>0,'Whole info'!K2>0),10%,0%),
ActiveSheet B25=IF('Whole info'!L2>0,10%,0%)

I hope you can help me convert this in code.

Thanks in advance
 

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Meko1

New Member
Joined
Oct 20, 2020
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
Please and 1 more thing, how to skip the written cells?
I mean if I have:

Sheet1.Range("B5")=ActiveSheet.Range("A5")...
Sheet1.Range("C5")=ActiveSheet.Range("B5").
.
.
.
And moving to other ActiveSheet and running the same macro it will overwrite the data on the already filled cells.
So how can I tell it, if there is a data already in the following cells to move 1 cell down?

P.S like a bonus question :)

Thanks in advance.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,947
Messages
5,621,772
Members
415,856
Latest member
jimb2k

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
Top