Help with adding vba code to existing code that is working

Get_Involved

Active Member
Joined
Jan 26, 2007
Messages
383
When I place a number in Cell "C2" of the Bid Calculator.

Is there some code that can be placed in this code to find the number from Cell C2 of the Bid Calculator, and place it in the "Legend" Cells "E4:E18" then plus + 1 only in the cell of the same row, of "R4:R18”?

As it is formulated now it updates all the cells in "R4:R18" at the same time.

But I need it to only update the row of the "Legend" Cells "E4:E18" that has a number that matches the Cell of “C2 of the Bid Calculator”
Each of the rows in the "Legend" Cells "E4:E18" will have a different number based on the number I place in Cell “C2 of the Bid Calculator”

Here is the code I have
Code:
    Dim rng As Range
    Dim m As Variant
    Dim s1 As Worksheet, s2 As Worksheet
    Set s1 = Sheets("Bid Calculator")
    Set s11 = Sheets("Legend")
    Set rng = s1.Range("C29:G29")
    m = Application.WorksheetFunction.Max(rng)
    s11.Range("R4") = m + 1
    s11.Range("R5") = m + 1

    s1.Range("C29") = m + 1

The numbers in the sheet "Legend" Row R4:R18 represent the numbers of loads each truck has hauled.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I have reworded my question better I think, hoping maybe to be understood.

When I place a number in Cell "C2" of the Bid Calculator.

Is there some code that can be placed in the code to find the number from Cell C2 of the Bid Calculator.

That number is in one of the cells of the "Legend" Cells "E4:E18".

As it is formulated now it updates all the cells in "R4:R18" at the same time, no matter if there is a number in Cell "C2" of the Bid Calculator or not.

What I need it to do is only update the row of the "Legend" Cells "R4:R18", when "Legend" Cells "E4:E18" has a number that matches the Cell of “C2 of the Bid Calculator”
Each of the rows in the "Legend" Cells "E4:E18" will have a different number based on the number I place in Cell “C2 of the Bid Calculator”
Here is the code I have
Code:
    Dim rng As Range
    Dim m As Variant
    Dim s1 As Worksheet, s2 As Worksheet
    Set s1 = Sheets("Bid Calculator")
    Set s11 = Sheets("Legend")
    Set rng = s1.Range("C29:G29")
    m = Application.WorksheetFunction.Max(rng)
    s11.Range("R4") = m + 1
    s11.Range("R5") = m + 1
 s1.Range("C29") = m + 1

The numbers in the sheet "Legend" Row R4:R18 represent the numbers of loads each truck has hauled.

Thanks in Advance
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,858
Members
452,676
Latest member
woodyp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top