VBA - Loop Help

siladinlol

New Member
Joined
Jan 9, 2014
Messages
4
Hello,

First time posting on this site and not too familiar with VBA excel, been learning just from trial and error.

I have an excel spreadsheet with 3 columns and 40 rows, my code takes the information from WeeklyScheduleNew's first row and inserts it into the tab "0'' - 8.75'' FMM" which is set up like a label, then the code prints that sheet for me and moves to the next row. Problem is I have multiple sheets that are for different sizes and need a way for the code to not print a row if it has a size over 9.

Here is my code:

Sub PrintMacro()
Dim i As Integer
For i = 1 To 40

Worksheets("0'' - 8.75'' FMM").Range("B2").Value = _
Worksheets("WeeklyScheduleNew").Range("C" & i).Value
Worksheets("0'' - 8.75'' FMM").Range("B3").Value = _
Worksheets("WeeklyScheduleNew").Range("A" & i).Value
Worksheets("0'' - 8.75'' FMM").Range("C3").Value = _
Worksheets("WeeklyScheduleNew").Range("B" & i).Value
Worksheets("0'' - 8.75'' FMM").Range("B4").Value = _
Worksheets("WeeklyScheduleNew").Range("D" & i).Value
ActiveSheet.PrintPreview

Next i

End Sub

Hope this is clear, please help with this problem.

Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

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