Results 1 to 10 of 10

[SOLVED] VBA Code to autofill formula till last row with data

Threaded View

  1. #1
    Registered User
    Join Date
    06-04-2012
    Location
    Bulgaria
    MS-Off Ver
    Excel 365 & Excel 2016
    Posts
    36

    [SOLVED] VBA Code to autofill formula till last row with data

    Hello,

    I've searched here and there and see that a similar question has been raised many times, however was still unable to come up with a solution for myself

    This is the thing:

    I have data in Column A (Range A1:A15).

    In Column B (Range B1:B1 = Cell B1) I have the following formula: "=MID(LEFT(A1,FIND(">",A1)-1),FIND("<",A1)+1,LEN(A1))" which works fine and is returning me value in Cell B1, based on Cell A1.

    I want a simple line VBA code, which autofill till the last row with data (in this case Cell A15) within Cell B2 till Cell B15.

    And since the data in Column A may vary let's say I have not 15, but 50, 60, or 100 rows, this code to be suitable respectively to autofill till B50, B60, or B100.

    P.S. I've found several possible solutions, which worked for other users with similar problems, however all of them were kind of "code within the code = first they define the range A as dynamic, but for this they use a separate code. Since I am not very familiar with VBA, is there more simple way to do that? I mean just to enter the code as one row within my code ...

    A 'solution' like the below one offered for me is not really working for a newbie like me

    Sub
    Dim last_row As Long

    last_row = Cells(Rows.Count, 2).End(xlUp).Row

    Range("B1").Formula = "=MY_FORMULA_HERE"

    Range("B1").AutoFill Destination:=Range("B1:B" & last_row)

    EndSub
    Attached Files Attached Files
    Last edited by Air^Canada; 01-24-2023 at 09:58 AM. Reason: solved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need VBA code to fill header values and drag formula till end of last row on target column
    By MicroTees in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-20-2022, 04:33 PM
  2. need vba code to fill formula where cursor start till end of result in header value
    By MicroTees in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2021, 12:03 PM
  3. Code to Add multiplication formula till the last row
    By saravanan1981 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-03-2019, 05:20 PM
  4. [SOLVED] VBA to autofill number till last row
    By shiva_reshs in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-21-2014, 01:16 PM
  5. [SOLVED] How to autofill any formula till last empty cell
    By nur2544 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-16-2013, 08:56 AM
  6. Count till met criteria, reset counter and count further
    By Romas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2011, 01:42 PM
  7. [SOLVED] VBA code to Autofill one cell to many rows below where row count will change
    By TrainingGoddess in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-27-2005, 11:06 PM

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