+ Reply to Thread
Results 1 to 2 of 2

How to calculate distances between two cells in VBA?

  1. #1
    Registered User
    Join Date
    06-19-2015
    Location
    Bogota
    MS-Off Ver
    Officce 365
    Posts
    54

    Question How to calculate distances between two cells in VBA?

    Hi all! I have been working with you the last weeks because I have been consulting the forum a lot. Thanks a lot for spreading the knowledge.

    I need your help because I couldn't find anything like this. I am not consider myself a developer really, I just know how to copy and paste and change little things. That's maybe why I can't find anything else in Google.

    I need basically to do two things with the same logic of counting cells between two references

    I want to print this count in the fourth column automatically
    =COLUMNS(INDIRECT(C2))-COLUMNS(INDIRECT(B2))
    in this way in VBA

    Please Login or Register  to view this content.
    I don't want to print the formula directly in the cell, only the result.

    And for a loop that I need to build to repeat the printing in cells according to the amount of rows set in two variables... how do I calculate (instead of the distance between columns) the distance between rows.
    Range1 and Range2 are Range type and I get them from text in certain cells. What I want to do is to copy Range(Range1 & ":" & Range2) and paste it on the last row from column B of Destiny sheet and for the same amount of rows in column A to paste the Table name I get from Source and I also need to paste in "LoadTable".

    Please Login or Register  to view this content.

    The final result is a table in Destiny sheet made of tables of the sizes given by Range1:Range2 that are extracted from different Sources sheets. In the Destiny sheet the first column has to be named automatically with the Table name of origin and the tables pasted from column B.

    Hope make sense my doubt. Many thanks in advance.
    Gerónimo

    If you need the whole program for more info, it's here...

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: How to calculate distances between two cells in VBA?

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Distances
    By indraneel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2015, 03:48 AM
  2. [SOLVED] Calculate angles and distances from XYZ-points
    By Giake in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 07-27-2014, 09:23 PM
  3. Using google to calculate distances… in a macro
    By fosters_ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-15-2014, 03:37 PM
  4. Replies: 1
    Last Post: 05-14-2014, 10:13 PM
  5. Replies: 1
    Last Post: 12-15-2011, 10:42 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