How to fill Value in Cell if data is not available ?
Solved/Closed
Raj_1562
Posts
29
Registration date
Wednesday 26 August 2020
Status
Member
Last seen
29 August 2022
-
23 Apr 2021 à 09:10
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 29 Apr 2021 à 12:03
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 29 Apr 2021 à 12:03
Related:
- How to fill Value in Cell if data is not available ?
- Tmobile data check - Guide
- Data transmission cable - Guide
- Download facebook data - Guide
- How to copy data from one excel sheet to another - Guide
- Conditional formatting if cell contains text ✓ - Excel Forum
1 response
TrowaD
Posts
2921
Registration date
Sunday 12 September 2010
Status
Contributor
Last seen
27 December 2022
555
29 Apr 2021 à 12:03
29 Apr 2021 à 12:03
Hi Raj,
When the products that need to be autofilled are in column B and the headers are in row 1, the following code will do the job:
Best regards,
Trowa
When the products that need to be autofilled are in column B and the headers are in row 1, the following code will do the job:
Sub RunMe()
Dim lRow, lRow2, x As Long
x = Range("C" & Rows.Count).End(xlUp).Row + 1
lRow = Range("B1").End(xlDown).Row
Do
If Range("B" & lRow + 1) = vbNullString Then
lRow2 = Range("B" & lRow).End(xlDown).Row
If lRow2 > x Then lRow2 = x
Range("B" & lRow).AutoFill Destination:=Range(Cells(lRow, "B"), Cells(lRow2 - 1, "B"))
lRow = lRow2
Else
lRow = lRow + 1
End If
Loop Until lRow2 = x
End Sub
Best regards,
Trowa
