Posts by Mumps

    I think I understand how you got:

    for HWS i need 116.25 + 116.25 +116.25 + 116.25 + 116.25 + 116.25 + 116.25 + 116.25

    They are the values for C28:C35 and that total would be saved in the variable 1hws for the first anchor. Is this correct? How would you calculate the total for 2hws which would be for the second anchor?

    Since the anchor points can be in different sheets, how do you want that to be handled?

    Please attach updated versions of both files. Make sure they include all the user forms and macros including any code that you have added.

    Actually now i want to add the floor heights in column C from 1st anchor to blue colored single cell (That is loop location) in each HWS CHWS HWR and CHWR and store it in variable with same name that is hws chws hwr and chwr

    Also please explain what you want to do as above with an example from your data using specific cell addresses .

    Try:

    Have a look at the attached file. I have modified the code a bit. After you enter the riser number, press the RETURN key. Everything seems to be working properly except for the calculations because I really don't understand what the calculations are supposed to do. The code for the calculations would go in the CommandButton1_Click code module. I might be able to help if you could describe step by step, referring to specific cells, rows, columns and sheets how the calculations should work, what the end result of the calculations would be and where you want to put the results. Use the actual values in the "1-2" sheet that you posted to describe the steps.

    We can make this work without using activeworkbook and activesheet because they can be tricky at times. Will the sheet name always be the same? If so, what is the name? If not, will it always be the first sheet in the workbook? Also, will you have only those two workbooks open when the code runs?

    I'm not sure if I understood correctly what you want to do. However, have a look at the code in the attached file. In the CommandButton1_Click code, I have defined a range (workRange) that corresponds to the columns associated with the riser number. For example, if you enter HC-01, the variable "workRange" will refer to the range E10:H46. I hope this helps.

    First of all, I didn't realize that you were working with two files, one containing the macro and the other the data. The original macro I suggested won't work properly because it refers to the workbook containing the macro, not the data workbook. So unless you have changed the macro, it won't work as written. Secondly, do you want the identification of the 4 columns and the further calculations to be done when you click the "Calculate" button on the userform? Also, what further calculations do you want to do?

    It's hard to work with pictures. Please attach a file that includes all your sheets, userforms and macros. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).

    You are very welcome. :)


    This should also work:

    Code
    1. Sub PasteValues()
    2. Application.ScreenUpdating = False
    3. Dim fnd As Range
    4. Set fnd = Rows(11).Find("ok", LookIn:=xlValues, lookat:=xlWhole)
    5. If Not fnd Is Nothing Then
    6. Range(Cells(50, fnd.Column), Cells(586, fnd.Column)).Value = Range(Cells(50, fnd.Column), Cells(586, fnd.Column)).Value
    7. End If
    8. Application.CutCopyMode = False
    9. Application.ScreenUpdating = True
    10. End Sub