Please Check my VBA code

Meko1

New Member
Joined
Oct 20, 2020
Messages
44
Office Version
  1. 2016
Platform
  1. Windows
Hello
I would like a advanced VBA user to see my code pls.

I am just making simple if functions in VBA, but since I am new it is not that easy to me.

So the code is following:


If Sheet10.Range("N2").Value > 0 Then ActiveSheet.Range("B22").Value = 0.5
Else: Range("B22").Value = 0

If Sheet10.Range("M2").Value > 0 Then ActiveSheet.Range("B23").Value = 0.1
Else: Range("B23").Value = 0

If Sheet10.Range("L2").Value > 0 Then ActiveSheet.Range("B25").Value = 0.1
Else: Range("B25").Value = 0

If Sheet10.Range("J2").Value > 0 Then ActiveSheet.Range("B24").Value = 0.1
Else: Range("B24").Value = 0

If Sheet10.Range("K2").Value > 0 Then ActiveSheet.Range("B24").Value = 0.1
Else: Range("B24").Value = 0


So, am I correct, and while using else I want it to leave that cell with value 0.

And I have another issue, in other problem, while moving data from one sheet cells to another sheet cells, and those cells already have data inside, how to ask VBA if there is data go 1cell down and fill from there.

Tanks in advance.
Hope for your quick response.
 
You are right, that is what I mentioned, No I just had it to other name, and Master at first I though it was kind of command like Active so that is why I changed it, but I deleted that, Changed **** name to master and changed i=9 but now it does not move any data at all
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I'm sorry I guess I misread your original post.
I thought you wanted the values in all those ranges copied to sheet1
But I guess I got confused now I see you want something like if this cell value is greater then do this or do this.
I'm going to have to pass on this question. I hope someone else can help you.
Sorry about getting confused
 
Upvote 0
Ok thank you for your help, there was a bit miscommunication from my side I guess since I am not native English speaker, I will figure it out based on you script.
Have a good day and thanks again
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,817
Members
449,049
Latest member
cybersurfer5000

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