View Single Post
 
Old 12-18-2023, 08:17 PM
soroush.kalantari soroush.kalantari is online now Windows 10 Office 2021
Competent Performer
 
Join Date: Jun 2021
Posts: 115
soroush.kalantari is on a distinguished road
Default

Thank you for your guidance. I don't understand what you mean by "PS". According to your hint, I have changed the code as following. But it still gives error. (this time at i=3)

Option Explicit
Sub forlloop()
Dim cell0 As Range
Dim i As Integer
Dim n As Integer
Dim j As Integer
Set cell0 = Cells(1, 1)
n = 45
For i = 0 To ActiveSheet.Range("A1").SpecialCells(xlCellTypeLas tCell).Row - 1
cell0.Offset(i).Select
If Selection.Value = "total" Then
cell0.Offset(i, n - 1).Value = "end"
Else
MsgBox IsError(Selection.Font.ThemeColor)
If IsError(Selection.Font.ThemeColor) = True Then
If Selection.Font.ThemeColor = xlThemeColorDark1 Then
cell0.Offset(i, n - 1).Value = "beg"
End If
End If
End If
Next i
End Sub
Reply With Quote