Im using the code:[
vb]
Sub printtermination()
Range("B3:BU3").Select
Application.ScreenUpdating = False
For Each cell In Range("B3:BU3")
If cell.Value = "1" Then
Debug.Print cell.Address & " 1"
cell.EntireColumn.Select
With Selection
.EntireColumn.Hidden = True
End With
End If
DoEvents
If cell.Value = "0" Then
Debug.Print cell.Address & " 0"
cell.EntireColumn.Select
With Selection
.EntireColumn.Hidden = False
End With
End If
DoEvents
Next cell
Application.ScreenUpdating = True
End Sub
This code gets about half way through and messes up...?
$B$3 0
$C$3 0
$D$3 0
$E$3 0
$F$3 1
$G$3 1
$H$3 0
$I$3 0
$J$3 0
$K$3 0
$L$3 1
$M$3 1
$N$3 0
$O$3 0
$P$3 0
$Q$3 0
$R$3 0
$S$3 1
$T$3 0
$U$3 0
$V$3 0
$W$3 0
$X$3 1
$Y$3 1
$Z$3 0
$AA$3 0
$AB$3 0
$AC$3 0
$AD$3 0
$AE$3 1
$AF$3 1
$AG$3 0
$AH$3 0
$AI$3 0
$AJ$3 0
$AK$3 1
'Mistakes start here
$AL$3 0
$AM$3 0
$AN$3 0
$AO$3 0
$AP$3 1
$AQ$3 1
$AR$3 0
$AS$3 0
$AT$3 0
$AU$3 0
$AV$3 0
$AW$3 1
$AX$3 0
$AY$3 0
$AZ$3 0
$BA$3 0
$BB$3 1
$BC$3 1
$BD$3 0
$BE$3 0
$BF$3 0
$BG$3 0
$BH$3 1
$BI$3 1
$BJ$3 0
$BK$3 0
$BL$3 0
$BM$3 0
$BN$3 0
$BO$3 1
$BP$3 0
$BQ$3 0
$BR$3 0
$BS$3 0
$BT$3 1
$BU$3 1
any help is appreciated..thanks!!