+ Reply to Thread
Results 1 to 5 of 5

VBA Loop - Horizontally & Vertically

  1. #1
    Registered User
    Join Date
    03-17-2019
    Location
    New Delhi
    MS-Off Ver
    2010
    Posts
    2

    VBA Loop - Horizontally & Vertically

    I am trying to use loop both vertically and horizontally. how to use it both?

    attached is the sample screenshotCODE_SCREENSHOT.jpgSCREENSHOT.jpg

    Need your help on this.

    Thanks.!

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,936

    Re: VBA Loop - Horizontally & Vertically

    Welcome to the Forum siva_satya!

    Where you are using

    Please Login or Register  to view this content.
    replace it with

    Please Login or Register  to view this content.
    That should be all that's necessary.

    Notes for the future:

    An image attachment has limited value. Just attach the Excel file. It's easier than taking a screenshot first and then attaching that.

    Having your file allows us to see and experiment with your data, layout, formulas, code, and possibly attach a file with a completed solution. If you are looking for formulas to produce a desired result, it helps if you create a mock-up of what you want the result to look like. Otherwise we would have to build something from scratch, trying to guess what you want it to look like.

    The paper clip icon does not work for attachments. To attach a file, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.

    You can also copy your code and paste it here as text, instead of showing a screenshot. When showing code, use code tags. There are two ways to add code tags. One is to select the code part of the text so it is highlighted, then press the "#" button in the edit controls. The other is to simply type in the tags:

    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,940

    Re: VBA Loop - Horizontally & Vertically

    Hi and welcome

    To answer your question you loop through the two dimensions something like this:
    Please Login or Register  to view this content.
    However, in this particular instance there is no need to loop as you can apply the formula and turn it into values in one go like this:
    Please Login or Register  to view this content.
    BSB

  4. #4
    Registered User
    Join Date
    03-17-2019
    Location
    New Delhi
    MS-Off Ver
    2010
    Posts
    2

    Re: VBA Loop - Horizontally & Vertically

    Thanks for your help.

    I tried as suggested, but its not printing on desired cells.

    In my opinion we need to change the second criterion "Range(f1)" in the formula. but not able to understand how.

    I tried putting "cells(i , x)" in above criterion but it still didn't work. pls suggest what to write in highlighted section.

    Capture1.JPG


    Thanks!
    Attached Files Attached Files

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,338

    Re: VBA Loop - Horizontally & Vertically

    Try this.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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] Add New Records Horizontally Not Vertically ?
    By Logit in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-19-2019, 04:51 AM
  2. [SOLVED] Find Max value horizontally and vertically in table
    By SHI.NL in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-17-2018, 11:31 AM
  3. Display data horizontally not vertically through VBA
    By webanalytics1 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-27-2015, 10:44 AM
  4. [SOLVED] Lookup Horizontally & Vertically
    By djfatboyfats in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-03-2014, 12:07 PM
  5. Can you autofill horizontally and vertically?
    By keez1993 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-27-2014, 03:59 AM
  6. [SOLVED] Is it possible to freeze both vertically and horizontally?
    By claralou in forum Excel General
    Replies: 4
    Last Post: 09-27-2013, 05:04 AM
  7. [SOLVED] Sumproduct vertically and horizontally
    By jimstrongy in forum Excel General
    Replies: 2
    Last Post: 03-21-2012, 04:37 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