Re: Set up an If Macro

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





"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
Insert>Module
Paste code into white pane that appears
Alt+F11 to rturn to Excel

To use
Alt+F8
Select macro Fillblanks>Run

--
Regards
Roger Govier

"Melissa" <Melissa@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6BC60917-027D-417D-853F-AC41C5D66AE5@xxxxxxxxxxxxxxxx


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,
.



Relevant Pages

  • Re: Formulas/Macros on Entire Sheet
    ... That was very lazy of me to assume that it was only Text on Danielle's sheet, and not post a full solution. ... Roger Govier ... If selectie Is Nothing Then Exit Sub ... You will need to use a simple macro as below ...
    (microsoft.public.excel.misc)
  • Re: Sort WorkSheetName unknown
    ... Were you on the correct sheet when you ran the macro? ... What happens if you step through the macro with F8? ... "Roger Govier" wrote: ... End Sub ...
    (microsoft.public.excel.programming)
  • Re: Pop-up when running a macro
    ... "Roger Govier" wrote: ... Select items before copying them (though this is what the macro ... Last line before you end sub: ... macro is completely done running I would like for (sheet 3) to ...
    (microsoft.public.excel.misc)
  • Re: Formulas/Macros on Entire Sheet
    ... "Roger Govier" wrote: ... You will need to use a simple macro as below ... Paste code into white pane that appears ... Alt+F11 to return to Excel ...
    (microsoft.public.excel.misc)
  • Re: Dynamic Column in Pivot Table Macro
    ... earlier portion of the Macro didn't hide rows ... "Roger Govier" wrote: ... End Sub ... Set rng2 = ActiveSheet.Cells.SpecialCells ...
    (microsoft.public.excel.programming)