Results 1 to 11 of 11

Thread: Simple Loop

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Exclamation Simple Loop

    I have a spreadsheet with 495 rows and 12 columns full of equations that I wish to edit and calculate and then proceed to the next equation in the row below the existing line. I wish to then have this simple loop continue down the page to the end of the column.

    example:

    place cursor on an equation (any column) press {F2} then {F9} and {down}, repeat this loop 495 times?

    I've used this simple loop in basic and Lotus 123. I'm not well versed in Visual Basic within Excell.

    Do you have the power to translate the above loop to a working excell macro? "Oh mighty one"!
    Last edited by The Webster; Dec 7th, 2006 at 09:38 AM.

  2. #2
    Junior Member
    Join Date
    Oct 2006
    Posts
    30

    Re: Simple Loop

    did you try converting text to columns?

  3. #3
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: Simple Loop

    Hi

    If , in cell (AA4), I place the equation........... '=+'Chem Engrg'!D5...
    If any equation/formula in a cell starts with an apostrophe, then it will not be considered as an equation. It will be considered as a text.

    For example if you put '55 in a cell, it will be considered as text not a number... same goes for '=sum(A1:A2)...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  4. #4

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Resolved Re: Simple Loop

    BINGO!

    That does the trick!

    You're a Genius!

  5. #5
    Addicted Member malik641's Avatar
    Join Date
    Sep 2005
    Location
    South Florida :-)
    Posts
    221

    Re: Simple Loop

    Glad to see you got it working




    If you find any of my posts of good help, please rate it

  6. #6

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: Simple Loop

    For some reason, this last line does not work. The macro stops at this line

    Selection.pastespecial paste:= xlpastevalues, operations: xlnone, skip blanks_:= false, transpose:= false

    Any suggestions?

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Re: Simple Loop

    Here's where the code stops......

    "see attachment"
    Attached Files Attached Files

  8. #8
    Addicted Member malik641's Avatar
    Join Date
    Sep 2005
    Location
    South Florida :-)
    Posts
    221

    Re: Simple Loop

    You can also try this if you like:

    VB Code:
    1. Sub PlaceValues()
    2.     Dim cell As Excel.Range, rng As Excel.Range
    3.     Set rng = ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas)
    4.     For Each cell In rng
    5.         cell.Value = cell.Value
    6.     Next
    7. End Sub

    Hope this helps




    If you find any of my posts of good help, please rate it

  9. #9

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Question Re: Simple Loop

    Thank you for your coding. As I used the macro one result became clear. The value of equation does not appear. For instance.....

    If , in cell (AA4), I place the equation........... '=+'Chem Engrg'!D5
    .....then if I use the macro, the equation does not calculate to the value in cell D5 from Sheet 'Chem Engrg'.
    .....nor does pressing [F2] and then [F9] , with cursor placed on cell, change the equation to a value. The equation..... '=+'Chem Engrg'!D5 remains.

    If however, in another cell, I write........... =right(AA4,17)
    the cell will give me the equation............ =+'Chem Engrg'!D5
    ....then when I place my cursor on the new equation and press [F2] and then [F9], the value of cell 'Chem Engrg'!D5 appears. (real number 123.1)

    The macro does not remove the " ' " from the text '=+'Chem Engrg'!D5

    There may be an easier way to produce the desired result. However, I do not know of Visual Basics capabilities.

    How do I tweek the macro to allow the value of the cell to apprear rather than the equation?

  10. #10
    Addicted Member malik641's Avatar
    Join Date
    Sep 2005
    Location
    South Florida :-)
    Posts
    221

    Re: Simple Loop

    Quote Originally Posted by The Webster
    Thank you for your coding. As I used the macro one result became clear. The value of equation does not appear. For instance.....

    If , in cell (AA4), I place the equation........... '=+'Chem Engrg'!D5
    .....then if I use the macro, the equation does not calculate to the value in cell D5 from Sheet 'Chem Engrg'.
    .....nor does pressing [F2] and then [F9] , with cursor placed on cell, change the equation to a value. The equation..... '=+'Chem Engrg'!D5 remains.

    If however, in another cell, I write........... =right(AA4,17)
    the cell will give me the equation............ =+'Chem Engrg'!D5
    ....then when I place my cursor on the new equation and press [F2] and then [F9], the value of cell 'Chem Engrg'!D5 appears. (real number 123.1)

    The macro does not remove the " ' " from the text '=+'Chem Engrg'!D5

    There may be an easier way to produce the desired result. However, I do not know of Visual Basics capabilities.

    How do I tweek the macro to allow the value of the cell to apprear rather than the equation?
    Did you try my solution posted above?




    If you find any of my posts of good help, please rate it

  11. #11

    Thread Starter
    New Member
    Join Date
    Dec 2006
    Posts
    6

    Exclamation Re: Simple Loop

    Yes!
    ...and the dilemma continues.

Posting Permissions

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



Click Here to Expand Forum to Full Width