# Posts by eduboys

Re: rounding to the nearest .25

Probably inefficient, but you could do it with a formula...

Lets say your number was in A1

=INT(M2)+IF((M2-INT(M2))<0.25,0,IF((M2-INT(M2))<0.5,0.25,IF((M2-INT(M2))<0.75,0.5,0.75)))

Re: Debugging setting ranges equal to each other.

I changed the Macro to use cut and paste, and everything works fine, just curious why the above code did not work.

I'm running into a problem with a particular row when copying this information from one sheet to another. This has worked for the last month without a problem, but one particular cell broke it today, and I cannot determine why. Below is my VBScript.

[Code]
The cell that is breaking my macro is below (I removed actual text, but left all punctuation):

Re: Setting ranges equal to each other between 2 sheets

Worked like a charm... I'm still getting used to coding in VBA. Thank you for the quick help!!

In an attempt to optimize my macro, I want to set ranges equal to each other instead of copying and pasting values. Is this possible across 2 different worksheets?

I cannot determine why this code segment is not currently working:

Code
``Sheets("Open and Pending Issues").Range(Cells(1, 1), Cells(MyLastRow, 18)) = Sheets("All Issues").Range(Cells(1, 1), Cells(MyLastRow, 18)).Value``

If I substitute the following, the code works fine:

Code
``Sheets("Open and Pending Issues").Range("A1:S331") = Sheets("All Issues").Range(Cells(1, 1), Cells(MyLastRow, 18)).Value``

Re: PasteSpecial

Is this much faster than using the copy and paste functions?

Re: Variable Print Area

Not sure how to search for the row of the last subtotal, but I know you need to set a range. In the example below you go to the bottom of all rows and select that range.

[vba]
Range("C5:Q5").Select
Range(Selection, Selection.End(xlDown)).Name = "PrintRangeName"

ActiveSheet.PageSetup.PrintArea = "\$C\$5:" & "PrintRangeName"
[/vba]