Wa alaykumu s-salam HaasSalam Brother Rahman
I did replied to you. Thanks for your hard work. Take Care Love you all
Dear HabibSalam, Brother Rahman
Thank you very much for you time and effort. My son Noah have to submit the project by Oct 20th 2023. i know you are very busy person and I appreciate. the count of color cells worked fine. The problem is with the gap VBA, I am attaching the sheet for your consideration
Thank you again
Sub DemoRStoreGapValuesWithColorBackgroundModified()
Dim ws1 As Worksheet
Dim col As Range
Dim cell As Range
Dim gapCount As Integer
Dim coloredCellFound As Boolean
Dim lastGapRow As Long
Dim columnColor As Long
Dim outputRow As Long
Dim sourceColumn As Range
Dim destColumn As Range
Set ws1 = ThisWorkbook.Sheets("Sheet1")
outputRow = 1
For Each col In ws1.Range("B1:Z1").Columns
Set sourceColumn = ws1.Range(col.Cells(38, 1), col.Cells(57, 1))
Set destColumn = ws1.Range(col.Cells(61, 1), col.Cells(80, 1))
gapCount = 0
coloredCellFound = False
columnColor = RGB(255, 255, 255)
For Each cell In sourceColumn
If Not IsEmpty(cell.Value) And cell.Interior.Color <> RGB(255, 255, 255) Then
If gapCount > 0 Then
destColumn.Cells(outputRow, 1).Value = gapCount
outputRow = outputRow + 1
gapCount = 0
End If
destColumn.Cells(outputRow, 1).Value = "R"
destColumn.Cells(outputRow, 1).Interior.Color = cell.Interior.Color
outputRow = outputRow + 1
coloredCellFound = True
Else
gapCount = gapCount + 1
End If
Next cell
If gapCount > 0 Then
destColumn.Cells(outputRow, 1).Value = gapCount
End If
outputRow = 1
Next col
End Sub
Wa alaykumu s-salam HabibSalam, Brother Rahman
Thank you very much, the gap sheet calculation numbers are excellent, only need to add a sheet3 and I need to change the Range's. It will be nice if you show me, which entrees need to be replace.
Thanks Again. Take Care
Dear HabibSalam, Brother Rahman
When I add sheet3 its giving error. I don't have room on sheet1. I am attaching .xlm and pictures of error. Please fix it. I have only 3 days left
Thanks Take Care
Sub Sheet3DestRStoreGapValuesWithColorBackgroundModified()
Dim ws1, ws3 As Worksheet
Dim col As Range
Dim cell As Range
Dim gapCount As Integer
Dim coloredCellFound As Boolean
Dim lastGapRow As Long
Dim columnColor As Long
Dim outputRow, temp As Long
Dim sourceColumn As Range
Dim destColumn As Range
Set ws1 = ThisWorkbook.Sheets("Sheet1")
Set ws3 = ThisWorkbook.Sheets("Sheet3")
outputRow = 1
temp = 1
For Each col In ws1.Range("B1:Z1").Columns
Set sourceColumn = ws1.Range(col.Cells(38, 1), col.Cells(57, 1))
Set destColumn = ws3.Range(ws3.Cells(2, temp), ws3.Cells(22, temp))
temp = temp + 1
gapCount = 0
coloredCellFound = False
columnColor = RGB(255, 255, 255)
For Each cell In sourceColumn
If Not IsEmpty(cell.Value) And cell.Interior.Color <> RGB(255, 255, 255) Then
If gapCount > 0 Then
destColumn.Cells(outputRow, 1).Value = gapCount
outputRow = outputRow + 1
gapCount = 0
End If
destColumn.Cells(outputRow, 1).Value = "R"
destColumn.Cells(outputRow, 1).Interior.Color = cell.Interior.Color
outputRow = outputRow + 1
coloredCellFound = True
Else
gapCount = gapCount + 1
End If
Next cell
If gapCount > 0 Then
destColumn.Cells(outputRow, 1).Value = gapCount
End If
outputRow = 1
Next col
End Sub
Wa alaykumu s-salam HabibDear, Brother Rahman, Salam
Thanks, I will update you soon, InshaAllah
Dear HabibThank you for all the hard work, very much appreciated. When I applied the VBA script to a large data all the result values were wrong. since morning I was trying to resolve the issue, just few minuted back with the mercy of Allah SWT it got resolved. the problem was this. [For Each col In ws1.Range("B1:Z1").Columns.] this B1:Z1 made me crazy, I was about to give up. This VBA is a crazy and interesting language at the same time.
Dear Habibone request if possible to resolve the issues with Sine values and the Forecast before this Friday, it will be excellent and his project will be complete. please make the range referencing flexible, so different sheets can be used.