Results 1 to 3 of 3

Macro to Autofill to Last Row using variable from InputBox - new to VBA

Threaded View

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Texas
    MS-Off Ver
    Excel 2003
    Posts
    58

    Macro to Autofill to Last Row using variable from InputBox - new to VBA

    I have the following code the works fine but my problem is on "Date" and "Location Code", Autofill is counting up with each cell to the next date/number. How can I keep Date and Location code the same for all cells that this code autofills?
    Sub Auto_Fill()
    
    P = InputBox("Purchaser Code", vbOKCancel)
    Sheets("sheet1").Range("b1") = P
    
    Dim LR As Long
    LR = Range("A666666").End(xlUp).Row
    Range("B1").autofill Destination:=Range("B1:B" & LR)
    
    M = InputBox("Shipping Method", vbOKCancel)
    Sheets("sheet1").Range("C1") = M
    Range("C1").autofill Destination:=Range("C1:C" & LR)
    
    R = InputBox("Requested Receipt Date", vbOKCancel)
    Sheets("sheet1").Range("D1") = R
    Range("D1").autofill Destination:=Range("D1:D" & LR)
    
    L = InputBox("Location Code", vbOKCancel)
    Sheets("sheet1").Range("E1") = L
    Range("E1").autofill Destination:=Range("E1:E" & LR)
    
    End Sub
    Last edited by MichaelGG1581; 02-17-2013 at 01:35 PM. Reason: Revised Problem

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1