Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:29:57+00:00 2026-06-13T21:29:57+00:00

I have formulas from columns O -> X and need them drag them to

  • 0

I have formulas from columns O -> X and need them drag them to last row used. Below is the current code I am using:

Dim wkb As Workbook
Dim wkbFrom As Workbook
Dim wks As Worksheet
Dim rng As Range
Dim path As String, FilePart As String
Dim TheFile
Dim loc As String
Dim Lastrow As Long

Set wkb = ThisWorkbook
loc = shPivot.Range("E11").Value
path = shPivot.Range("E12").Value
FilePart = Trim(shPivot.Range("E13").Value)
TheFile = Dir(path & "*" & FilePart & ".xls")
Set wkbFrom = Workbooks.Open(loc & path & TheFile & FilePart)
Set wks = wkbFrom.Sheets("SUPPLIER_01_00028257_KIK CUSTOM")
Set rng = wks.Range("A2:N500")

'Copies range from report generated to share drive and pastes into the current week tab of open order report
rng.Copy wkb.Sheets("Current Week").Range("A4")

With ActiveSheet

    Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
    .Range("O4:X4").AutoFill .Range("O4:X4").Resize(Lastrow)

End With

The code Lastrow is not dragging the formulas down

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:29:59+00:00Added an answer on June 13, 2026 at 9:29 pm

    You can do auto-fill like this in VBA (verified using macro recording)

    Range("O1:X1").Select
    Selection.AutoFill Destination:=Range("O1:X25"), Type:=xlFillDefault
    

    Now that you have this code as a base to work with you can use any variables you like in the syntax like this:

    Range("O1:X1").Select
    Selection.AutoFill Destination:=Range("O1:X" & Lastrow), Type:=xlFillDefault
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

G'day, I have never really used excel formulas before but need to convert a
I have couple of formulas and data coming from database. I want to refresh
I have some PHP code that is designed to make a spreadsheet with formulas
I have code which will only let me select 22 columns then comes up
Need a much Optimized code.Well I Got a Project and I have Succefully made
I have this original formula from a medical research book: Log(e) (EFW) = (-4.564+(0.282*AC)-(0.00331*AC^2))*1000
I have a question about this formula from a book: EFW (cm,kg)= 10^(-1,7492+(0,166*BPD)+(0,046*AC)-(2,646*AC*BPD/1000)) The
i have a strange issue with phpexcel on a pair of formulas and can't
Input: I have a LaTeX file, with plain text & math formulas. Desired output:
I have a formula that distribute reptitions (payments) into columns that represents months. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.