Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to fill a range in Column E, where there is data in E5 & E10, and
I wanted to be able to auto fill down, but only the blank cells. I wanted the last row in Column E to be filled down to the last row in Column A that is used. My macro doesnt seem to do anything. Sub AutoFill() Dim myR As Range Set myR = Cells(Rows.Count, 1).End(xlUp).Offset(-1, 0).Resize(1, 5) On Error Resume Next myR.AutoFill Destination:=Range _ (myR, myR.Offset(0, 5).End(xlDown).Offset(0, -1)) End Sub Can someone please help out? Regards, Ryan--- -- RyGuy |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ryan,
Does work for you? Option Explicit Sub AutoFill() Dim CountRows As Double Dim Iloop As Double 'Turn off warnings, etc. Application.ScreenUpdating = False Application.DisplayAlerts = False CountRows = Cells(Rows.Count, "A").End(xlUp).Row For Iloop = 2 To CountRows If IsEmpty(Cells(Iloop, "E")) Then Cells(Iloop, "E") = Cells(Iloop - 1, "E") End If Next Iloop 'Turn on warnings, etc. Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub -- Ken Hudson "ryguy7272" wrote: I am trying to fill a range in Column E, where there is data in E5 & E10, and I wanted to be able to auto fill down, but only the blank cells. I wanted the last row in Column E to be filled down to the last row in Column A that is used. My macro doesnt seem to do anything. Sub AutoFill() Dim myR As Range Set myR = Cells(Rows.Count, 1).End(xlUp).Offset(-1, 0).Resize(1, 5) On Error Resume Next myR.AutoFill Destination:=Range _ (myR, myR.Offset(0, 5).End(xlDown).Offset(0, -1)) End Sub Can someone please help out? Regards, Ryan--- -- RyGuy |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That's exactly it! I kept thinking I needed something like this:
Selection.FormulaR1C1 = "=R[-1]C" Well, thanks for getting that straightened out for me!!! Regards, Ryan--- -- RyGuy "Ken Hudson" wrote: Hi Ryan, Does work for you? Option Explicit Sub AutoFill() Dim CountRows As Double Dim Iloop As Double 'Turn off warnings, etc. Application.ScreenUpdating = False Application.DisplayAlerts = False CountRows = Cells(Rows.Count, "A").End(xlUp).Row For Iloop = 2 To CountRows If IsEmpty(Cells(Iloop, "E")) Then Cells(Iloop, "E") = Cells(Iloop - 1, "E") End If Next Iloop 'Turn on warnings, etc. Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub -- Ken Hudson "ryguy7272" wrote: I am trying to fill a range in Column E, where there is data in E5 & E10, and I wanted to be able to auto fill down, but only the blank cells. I wanted the last row in Column E to be filled down to the last row in Column A that is used. My macro doesnt seem to do anything. Sub AutoFill() Dim myR As Range Set myR = Cells(Rows.Count, 1).End(xlUp).Offset(-1, 0).Resize(1, 5) On Error Resume Next myR.AutoFill Destination:=Range _ (myR, myR.Offset(0, 5).End(xlDown).Offset(0, -1)) End Sub Can someone please help out? Regards, Ryan--- -- RyGuy |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is the additional line of code what you wanted to know?
Option Explicit Sub CopyCell1() Dim X As Long Dim Sh As Variant For Each Sh In Array("M", "P", "T", "A", "Mi", "Sm", "H") For X = 7 To 500 Sheets(Sh).Cells(X, "X") = (Sheets(1).Range("A1") / Sheets(1).Range(C20)) * 52 Sheets(Sh).Cells(X, "Y") = Sheets(1).Range("C1") + Sheets(1).Range("D1") Next Next End Sub -- Ken Hudson "ryguy7272" wrote: That's exactly it! I kept thinking I needed something like this: Selection.FormulaR1C1 = "=R[-1]C" Well, thanks for getting that straightened out for me!!! Regards, Ryan--- -- RyGuy "Ken Hudson" wrote: Hi Ryan, Does work for you? Option Explicit Sub AutoFill() Dim CountRows As Double Dim Iloop As Double 'Turn off warnings, etc. Application.ScreenUpdating = False Application.DisplayAlerts = False CountRows = Cells(Rows.Count, "A").End(xlUp).Row For Iloop = 2 To CountRows If IsEmpty(Cells(Iloop, "E")) Then Cells(Iloop, "E") = Cells(Iloop - 1, "E") End If Next Iloop 'Turn on warnings, etc. Application.ScreenUpdating = True Application.DisplayAlerts = True End Sub -- Ken Hudson "ryguy7272" wrote: I am trying to fill a range in Column E, where there is data in E5 & E10, and I wanted to be able to auto fill down, but only the blank cells. I wanted the last row in Column E to be filled down to the last row in Column A that is used. My macro doesnt seem to do anything. Sub AutoFill() Dim myR As Range Set myR = Cells(Rows.Count, 1).End(xlUp).Offset(-1, 0).Resize(1, 5) On Error Resume Next myR.AutoFill Destination:=Range _ (myR, myR.Offset(0, 5).End(xlDown).Offset(0, -1)) End Sub Can someone please help out? Regards, Ryan--- -- RyGuy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Automatically fill in third column depending on data in second column | Excel Programming | |||
Fill a column with the contents of another column based on a choic | Excel Discussion (Misc queries) | |||
Auto Fill Column with Date based on rows in other column | Excel Programming | |||
What to do to fill column 2 with part of whats in column 1 | Excel Discussion (Misc queries) | |||
Fill handle - new column using a column and one cell | Excel Discussion (Misc queries) |