this is my code snippet, when it runs I get a compile error "else without if" I don't understand what I have done incorrectly could anyone assist me please
Please Login or Register to view this content.
this is my code snippet, when it runs I get a compile error "else without if" I don't understand what I have done incorrectly could anyone assist me please
Please Login or Register to view this content.
Last edited by royUK; 12-11-2011 at 01:51 PM.
You are missing a "End if" statement after the last "Else" statement.
When posting code you need to add code tags around it.
You can read about it in the forum rules.
Please take time to read the forum rules
Sorry I missed the quotes. I've tried it with the "end if" between the last "else" but I still get the compile error, I've also tried it after "next cell" with the same result Have I put it in the wrong place?
Remove the colon in this line
Please Login or Register to view this content.
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
Added this time
A Select Case is much easier to follow
Please Login or Register to view this content.
Last edited by royUK; 12-11-2011 at 01:56 PM.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Hi thank you for your assistance. what I'm trying to do is add a value to a cell if its current value is less than or equal to a predetermined value, then once the static amount is set to multiply all cells by 30% and round to 2 decimal places.
Please Login or Register to view this content.
hi UKTV2C, this sets a cell value equal to cell value + 30% of this cell value rounded to 2 decimal points
Okay so I have the code correct, but where in the main body of code does it go in order for it to carry out it's function? Thank you all.
You've posted part of the codem we can't see where the it is from or where to place it. My code replaces your IF & ElseIf lines
Here it is again the whole snippet which is bringing up the compile error, could you please re write it for me so that it would work, my skills are obviously lacking. Thank you
Please Login or Register to view this content.
Hi Roy I have pasted the code almost a week ago, you were very kind then, I just have not understood. Would you be kind enough to adjust the code please so that if performs each action as required then performs the last function which is to multiply by 32% and round to two places. thanks in anticipation of your assistance.
Hi Roy I have pasted the code almost a week ago, you were very kind then, I just have not understood. Would you be kind enough to adjust the code please so that if performs each action as required then performs the last function which is to multiply by 32% and round to two places. thanks in anticipation of your assistance.
Try this:Please Login or Register to view this content.
Thanks so much for your help, yes it works on the correct file when I have the macro spreadsheet open testing. When I close it and use the VBA script to run it ti does not perform the function on the fie I want it to. I will have it wrong as I started our recording this Macro.
This is what I have to say which file to apply the macro to could you advise please?
Please Login or Register to view this content.
Hi Stephen I've worked it out thanks for all the assistance from all of you.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks