Drag down to a specific row

lightkerosene

New Member
Joined
Sep 30, 2015
Messages
15
So this code isnt working correctly for some reason and I can't figure out why.

It is supposed to drag the formulas down to the last row of column u. then copy all of the found values, then paste those values in a certain spot on another spreadsheet. I have been doing it manually as of now. But dragging the formulas down and pasting the values over manually is kind of annoying. Any help is appreciated.


Code:
Sub FitSheet()
'Clear and Hide
    Sheets("Macro Settings").Select
    Rows("3:3").Select
    Range(Selection, Selection.End(xlDown)).Select
    Application.CutCopyMode = False
    Selection.Clear
    Range("A2").Select
    Sheets("Macro Settings").Select
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("Macro Information").Select
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("Feature Report").Select
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("RPA").Select
    Range("A1").Select
    Sheets("Proposal").Select
    Application.ScreenUpdating = True
'Clear Blanks
Sheets("RPA").Select
Rows("5:3004").EntireRow.Hidden = False
Range("D3004").End(xlUp).Offset(6, 0).EntireRow.Select
Range(ActiveCell, ActiveCell.End(xlDown).EntireRow).Delete
Sheets("Proposal").Select
End Sub
Sub Import()
    Sheets("Smart Report").Select
    Range("I2:I3004").Select
    Dim cell As Range
    Dim InputValue As String
    On Error Resume Next
    InputValue = ("=Today()")
    If Selection.Cells.Count = "*" Then Exit Sub
    With Selection.Cells.SpecialCells(xlCellTypeBlanks).Select
    With Selection
    .Cells.Value = ("=Today()")
    End With
    End With
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
'Import basic stuff
'Network
Sheet8.Range("U2:U3001") = Sheet3.Range("AB2:AB3001").Value
'FAN
Sheet2.Range("B5:B3004") = Sheet3.Range("A2:A3001").Value
'BAN
Sheet2.Range("C5:C3004") = Sheet3.Range("E2:E3001").Value
'Phone Number
Sheet2.Range("D5:D3004") = Sheet3.Range("Q2:Q3001").Value
'End Date
Sheet2.Range("E5:E3004") = Sheet3.Range("I2:I3001").Value
'Make
Sheet2.Range("F5:F3004") = Sheet3.Range("AC2:AC3001").Value
'Model
Sheet2.Range("G5:G3004") = Sheet3.Range("AD2:AD3001").Value
'User
Sheet2.Range("H5:H3004") = Sheet3.Range("P2:P3001").Value
'Primary Line
Sheet2.Range("Q5:Q3004") = Sheet3.Range("X2:X3001").Value
'Minutes
Sheet2.Range("AQ5:AQ3004") = Sheet3.Range("AK2:AK3001").Value
'Data
Sheet2.Range("AR5:AR3004") = Sheet3.Range("AL2:AL3001").Value
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
Sub LastMacro()
    Application.ScreenUpdating = False
'Network Addon
Sheet2.Range("I5:I3004") = Sheet8.Range("V2:V3001").Value
'DragFormulas Paste
'Copy Row 2 to Row 3 through last data in Column U
     With Sheets("Macro Settings")
        .Rows("2:2").Copy
        .Rows("3:" & Range("U2").End(xlDown).Row).PasteSpecial
     End With
'International
Sheet2.Range("X5:X3004") = Sheet8.Range("A2:A3001").Value
Sheet2.Range("AZ5:AZ3004") = Sheet8.Range("A2:A3001").Value
'Insuarance
Sheet2.Range("Y5:Y3004") = Sheet8.Range("B2:B3001").Value
Sheet2.Range("BA5:BA3004") = Sheet8.Range("B2:B3001").Value
'Enhanced Push to Talk
Sheet2.Range("AA5:AA3004") = Sheet8.Range("C2:C3001").Value
Sheet2.Range("BC5:BC3004") = Sheet8.Range("C2:C3001").Value
'AT&T MDM
Sheet2.Range("AB5:AB3004") = Sheet8.Range("D2:D3001").Value
Sheet2.Range("BD5:BD3004") = Sheet8.Range("D2:D3001").Value
'Forms
Sheet2.Range("AC5:AC3004") = Sheet8.Range("E2:E3001").Value
Sheet2.Range("BE5:BE3004") = Sheet8.Range("E2:E3001").Value
'Toggle
Sheet2.Range("AD5:AD3004") = Sheet8.Range("F2:F3001").Value
Sheet2.Range("BF5:BF3004") = Sheet8.Range("F2:F3001").Value
'MRAS
Sheet2.Range("AE5:AE3004") = Sheet8.Range("G2:G3001").Value
Sheet2.Range("BG5:BG3004") = Sheet8.Range("G2:G3001").Value
'Comet
Sheet2.Range("AF5:AF3004") = Sheet8.Range("H2:H3001").Value
Sheet2.Range("BH5:BH3004") = Sheet8.Range("H2:H3001").Value
'Airwatch
Sheet2.Range("AI5:AI3004") = Sheet8.Range("J2:J3001").Value
Sheet2.Range("BK5:BK3004") = Sheet8.Range("J2:J3001").Value
'AprivaPay
Sheet2.Range("AG5:AG3004") = Sheet8.Range("I2:I3001").Value
Sheet2.Range("BI5:BI3004") = Sheet8.Range("I2:I3001").Value
'Big Tin Can
Sheet2.Range("AL5:AL3004") = Sheet8.Range("K2:K3001").Value
Sheet2.Range("BN5:BN3004") = Sheet8.Range("K2:K3001").Value
'Box
Sheet2.Range("AM5:AM3004") = Sheet8.Range("L2:L3001").Value
Sheet2.Range("BO5:BO3004") = Sheet8.Range("L2:L3001").Value
'OAH
Sheet2.Range("AN5:AN3004") = Sheet8.Range("M2:M3001").Value
Sheet2.Range("BP5:BP3004") = Sheet8.Range("M2:M3001").Value
'Office Direct
Sheet2.Range("AO5:AO3004") = Sheet8.Range("N2:N3001").Value
Sheet2.Range("BQ5:BQ3004") = Sheet8.Range("N2:N3001").Value
'Access My LAN
Sheet2.Range("Z5:Z3004") = Sheet8.Range("P2:P3001").Value
Sheet2.Range("BB5:BB3004") = Sheet8.Range("P2:P3001").Value
'Business Messaging
Sheet2.Range("AP5:AP3004") = Sheet8.Range("O2:O3001").Value
Sheet2.Range("BR5:BR3004") = Sheet8.Range("O2:O3001").Value
'Xora
Sheet2.Range("AK5:AK3004") = Sheet8.Range("Q2:Q3001").Value
Sheet2.Range("BM5:BM3004") = Sheet8.Range("Q2:Q3001").Value
'TeleNAV
Sheet2.Range("AJ5:AJ3004") = Sheet8.Range("R2:R3001").Value
Sheet2.Range("BL5:BL3004") = Sheet8.Range("R2:R3001").Value
'Unlimited Data
Sheet2.Range("L5:L3004") = Sheet8.Range("T2:T3001").Value
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
"But dragging the formulas down...."
Try double clicking the fill handle.
 
Upvote 0
Takes you down 10000090 rows
That indicates the number of cells to the left of the fill down that have sort of contiguous data in them (including formulas with "" as a result.)
CTRL+END should take you to same row. Do you actually expect "10000090" (did you add in an extra zero?) rows of data?
 
Upvote 0
I think you are going to last row available to the WorkSheet, Row 1,048,576 when you use .... .End(xlDown)... I think that should be .End(xlUp)
 
Upvote 0
Also, could you reiterate your intention with this snippet from your code?
Code:
'Copy Row 2 to Row 3 through last data in Column U
     With Sheets("Macro Settings")
        .Rows("2:2").Copy
        .Rows("3:" & Range("U2").End(xlDown).Row).PasteSpecial
     End With
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top