Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.
Become a Premium Member and unlock a new, free course in leading technologies each month.
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Sub Sample()
Dim i As Long, LastRow As Long, CLastRow As Long
Dim ws As Worksheet
Dim temp As Long
Set ws = Sheets("Flavored non FOB")
LastRow = ws.Range("F" & Rows.Count).End(xlUp).Row + 1
For i = 6 To LastRow
If ws.Range("F" & i).Font.Bold = True And _
Len(Trim(ws.Range("F" & i).Value)) <> 0 Then
ws.Range("F" & i).Offset(, -3).Value = ws.Range("F" & i).Value
If temp <> 0 Then
ws.Range("C" & temp).AutoFill Destination:=Range("C" & temp & ":C" & i - 1)
End If
temp = i
End If
Next i
CLastRow = ws.Range("C" & Rows.Count).End(xlUp).Row
ws.Range("C" & CLastRow).AutoFill Destination:=ws.Range("C" & CLastRow & ":C" & LastRow)
End Sub
Updated-EE-Copy-Test.xlsm
Sub Sample()
Dim i As Long, LastRow As Long, CLastRow As Long
Dim ws As Worksheet, wsheet As Worksheet
Dim temp As Long
For Each wsheet In ThisWorkbook.Sheets
Set ws = Sheets(wsheet.Name)
LastRow = ws.Range("G" & Rows.Count).End(xlUp).Row + 1
For i = 6 To LastRow
If ws.Range("G" & i).Font.Bold = True And _
Len(Trim(ws.Range("G" & i).Value)) <> 0 Then
ws.Range("G" & i).Offset(, -3).Value = ws.Range("G" & i).Value
If temp <> 0 Then
ws.Range("D" & temp).AutoFill Destination:=Range("D" & temp & ":D" & i - 1)
End If
temp = i
End If
Next i
CLastRow = ws.Range("D" & Rows.Count).End(xlUp).Row
ws.Range("D" & CLastRow).AutoFill Destination:=ws.Range("D" & CLastRow & ":D" & LastRow)
Next
End Sub
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
Count text color with conditional formating in Excel | 4 | 65 | |
Macro to convert table into pivot tables | 25 | 68 | |
Excel not storing numeric string correctly | 5 | 37 | |
Need macro to assign two digit numbers to selected cells in Excel 2016 | 3 | 30 |
Join the community of 500,000 technology professionals and ask your questions.