View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Type Mismatch Error

You have a lot of assumptions in this reply.

I wonder how many apply to the OP's question.

ryguy7272 wrote:

Let's try to cake care of it this time...

The following macro will Fill Down Values in Column A, with Some Data
Already in Column A, Based on Number of Rows Filled in Column A.

Sub AutoFill()
Dim CountRows As Double
Dim Iloop As Double
'Turn off warnings, etc.
Application.ScreenUpdating = False
Application.DisplayAlerts = False
CountRows = Cells(Rows.Count, "E").End(xlUp).Row
For Iloop = 2 To CountRows
If IsEmpty(Cells(Iloop, "A")) Then
Cells(Iloop, "A") = Cells(Iloop - 1, "A")
End If
Next Iloop
'Turn on warnings, etc.
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub

Another sample...
Fill Down in Column D, Based on Used Range in Column E:
Sub fill()
Dim lastrow As Long
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "E").End(xlUp).Row
Range("D2").AutoFill Range("D2:D" & lastrow)
End Sub

HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.

"Dave Peterson" wrote:

Maybe...

Option Explicit
Sub testme()

Dim LastRow As Long
Dim RngToCopy As Range
Dim HowManyRows As Long

With ActiveSheet
LastRow = .Cells(.Rows.Count, "E").End(xlUp).Row

'using the last used cell in column A to get the row to copy
Set RngToCopy = .Cells(.Rows.Count, "A").End(xlUp)

HowManyRows = LastRow - RngToCopy.Row + 1

If HowManyRows 1 Then
RngToCopy.Resize(HowManyRows, 4).FillDown
End If
End With

End Sub



el dee wrote:

Hello,
Any ideas on the type misatch error I recieve here?
Sub Autofill()

LastRow = Range("E").End(xlUp)
Set Range1 = Range(Range("A2"), Range("D65536").End(xlUp).Offset(1, 0))
Range1.Select
Selection.Autofill Destination:=("Range1" & LastRow)

End Sub


--

Dave Peterson


--

Dave Peterson