Results 1 to 6 of 6

Thread: [RESOLVED] Automaticle calculate cell´s depending of another cell´s value

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2008
    Location
    LISBON
    Posts
    34

    Resolved [RESOLVED] Automaticle calculate cell´s depending of another cell´s value

    Hello, People i´m not getting it...

    i need to calculate the value o a cell in function of other cell value for example:

    if cell("A1").value = 1 then cell("A2").value = cell("A1").value + 1

    and also i need to run all cells in that row

    can anyone pleazz help?

    thankx

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Automaticle calculate cell´s depending of another cell´s value

    Moved From FAQ Section

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

    Re: Automaticle calculate cell´s depending of another cell´s value

    Change this

    cell("A1").value = 1 then cell("A2").value = cell("A1").value + 1

    to

    Code:
    'Change Sheet1 below to the name of the relevant sheet
    If Sheets("Sheet1").Range("A1").Value = 1 Then
        Sheets("Sheet1").Range("A2").Value = Sheets("Sheet1").Range("A1").Value + 1
    End If
    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
    Member
    Join Date
    Feb 2008
    Location
    LISBON
    Posts
    34

    Re: Automaticle calculate cell´s depending of another cell´s value

    OK , koolsid it worked fine for what i need thanks. now how do i , run it for the following rows ? (witch a cicle i think) I'm on A1 ,and i need to do it till the A300 for example.

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

    Re: Automaticle calculate cell´s depending of another cell´s value

    Here is an example

    vb Code:
    1. Option Explicit
    2. Sub test()
    3. Dim i As Integer
    4.  
    5. 'Change 300 to the respective row number
    6. For i = 1 To 300
    7.     'i will increment each time the for loop is
    8.     'executed for 300 times
    9.     If Sheets("Sheet1").Range("A" & i).Value = 1 Then
    10.         'your code
    11.     End If
    12. Next i
    13.  
    14. End Sub
    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

  6. #6

    Thread Starter
    Member
    Join Date
    Feb 2008
    Location
    LISBON
    Posts
    34

    Re: Automaticle calculate cell´s depending of another cell´s value

    Koolsid, it work´s perfectly
    Thankx man

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