ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Looping through checkboxes (https://www.excelbanter.com/excel-programming/433461-looping-through-checkboxes.html)

TomK76

Looping through checkboxes
 
I have a macro that has a pair of loops in it. I have inserted checkboxes
into the sheet to enable the user to skip certain lines when the macro runs.
The problem is I have Checkbox1, checkbox2, and so on.

For myLine = 1 To 5

If Sheet1.Checkbox1 = True Then

myPath = dirPath & ... & mySheet & "'!E24"

ActiveCell.Value = "='" & myPath

Cells(ActiveCell.Row + 1, 2).Select

Else

Cells(ActiveCell.Row + 1, 2).Select

End If

Next myLine

I want to use the "myLine" counter in the loop to check each checkbox for
the True condition.

I am sure there is a simple way, I just cannot seem to figure it out. Any
help would be appreciated. Thanks!

TomK76

Looping through checkboxes
 
I was able to get it, please disregard. Thanks!

"TomK76" wrote:

I have a macro that has a pair of loops in it. I have inserted checkboxes
into the sheet to enable the user to skip certain lines when the macro runs.
The problem is I have Checkbox1, checkbox2, and so on.

For myLine = 1 To 5

If Sheet1.Checkbox1 = True Then

myPath = dirPath & ... & mySheet & "'!E24"

ActiveCell.Value = "='" & myPath

Cells(ActiveCell.Row + 1, 2).Select

Else

Cells(ActiveCell.Row + 1, 2).Select

End If

Next myLine

I want to use the "myLine" counter in the loop to check each checkbox for
the True condition.

I am sure there is a simple way, I just cannot seem to figure it out. Any
help would be appreciated. Thanks!



All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com