Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Trying to write a macro to fill in the blank spots in column B. So if B2 = "" Then "Not ATT" if cell is not blank then skip cell, retain data and move to the next and keep processing until all data reviewed. A B 1 John Smith ATT 2 Tom Jones 3 Jane Henry DNS |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How about selecting the rangeeditreplaceleave blankwith Not ATT
-- Don Guillett Microsoft MVP Excel SalesAid Software "Melissa" wrote in message ... Trying to write a macro to fill in the blank spots in column B. So if B2 = "" Then "Not ATT" if cell is not blank then skip cell, retain data and move to the next and keep processing until all data reviewed. A B 1 John Smith ATT 2 Tom Jones 3 Jane Henry DNS |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "Roger Govier" wrote: Hi Sub Fillblanks() Dim lr As Long Rows("1:1").Insert Shift:=xlDown lr = Cells(Rows.Count, "A").End(xlUp).Row Range("A1:B1").AutoFilter Selection.AutoFilter Field:=2, Criteria1:="=" Range("B2:B" & lr) = "Not ATT" Rows("1:1").Delete End Sub Copy code above Alt+F11 to invoke VB Editor InsertModule Paste code into white pane that appears Alt+F11 to rturn to Excel To use Alt+F8 Select macro FillblanksRun -- Regards Roger Govier "Melissa" wrote in message ... Trying to write a macro to fill in the blank spots in column B. So if B2 = "" Then "Not ATT" if cell is not blank then skip cell, retain data and move to the next and keep processing until all data reviewed. A B 1 John Smith ATT 2 Tom Jones 3 Jane Henry DNS Roger - How would I need to change the macro if I wanted to get the cell populated with the data from the last field that it found was populated... for example: I have the following data: A | B 10 | | Adam | Mike | John 12 | | Stan | Frank and I want: 10 | 10 | Adam 10 | Mike 10 | John 12 | 12 | Stan 12 | Frank I could obviously just drag down, but there are just too many. THanks, |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi
the following should do what you want Sub Fillblanks2() Application.ScreenUpdating = False Dim lr As Long, i As Long lr = Cells(Rows.Count, "B").End(xlUp).Row For i = 2 To lr If Cells(i, 1) = "" And Cells(i, 2) = "" Then Rows(i).Delete If Cells(i, 2) < "" Then Cells(i, 1) = Cells(i - 1, 1).Value End If Next i Application.ScreenUpdating = True End Sub I have followed your example literally, and if there is a blank row between the sets of data, then it gets deleted. If you don't want that, then just remove the line If Cells(i, 1) = "" And Cells(i, 2) = "" Then Rows(i).Delete -- Regards Roger Govier "Wilson" wrote in message ... "Roger Govier" wrote: Hi Sub Fillblanks() Dim lr As Long Rows("1:1").Insert Shift:=xlDown lr = Cells(Rows.Count, "A").End(xlUp).Row Range("A1:B1").AutoFilter Selection.AutoFilter Field:=2, Criteria1:="=" Range("B2:B" & lr) = "Not ATT" Rows("1:1").Delete End Sub Copy code above Alt+F11 to invoke VB Editor InsertModule Paste code into white pane that appears Alt+F11 to rturn to Excel To use Alt+F8 Select macro FillblanksRun -- Regards Roger Govier "Melissa" wrote in message ... Trying to write a macro to fill in the blank spots in column B. So if B2 = "" Then "Not ATT" if cell is not blank then skip cell, retain data and move to the next and keep processing until all data reviewed. A B 1 John Smith ATT 2 Tom Jones 3 Jane Henry DNS Roger - How would I need to change the macro if I wanted to get the cell populated with the data from the last field that it found was populated... for example: I have the following data: A | B 10 | | Adam | Mike | John 12 | | Stan | Frank and I want: 10 | 10 | Adam 10 | Mike 10 | John 12 | 12 | Stan 12 | Frank I could obviously just drag down, but there are just too many. THanks, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
need help to update macro to office 2007 macro enabled workbook | Excel Discussion (Misc queries) | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
My excel macro recorder no longer shows up when recording macro | Excel Discussion (Misc queries) | |||
using a cell value to control a counter inside a macro and displaying macro value | Excel Worksheet Functions |