locked
DoubleClick a range of cells. RRS feed

  • Question

  • Hello Everyone,

    I'm trying to code with C# a script that  double click a range of cells. Just that. I need to this because this way the data (from Revit Autodesk Software) gets "activated" in the table. If I don't double click each cell, the formulas of the Excel file do not recognize the data. I had try with the DoubleClick() method with no sucess:

    ...
    
    worksheet.Range["Q24"].Offset[i - 1, 0].Value = width;
                    i++;
                    var range = worksheet.Range["Q24", "Q60"];
                    range.Application.DoubleClick();
    
    ...


    Every comment is welcome.

    Thanks for your time.

    Sunday, September 18, 2016 5:31 PM

Answers

  • Thanks for your answers. I try the first solution with no result in Visual Studio. I didn't try the second option because I found out another way making a conversion of units and exporting as a double instead of a string to solve my issue. Thanks for your time.
    • Proposed as answer by David_JunFeng Monday, September 26, 2016 2:18 PM
    • Marked as answer by David_JunFeng Monday, September 26, 2016 2:18 PM
    Monday, September 19, 2016 2:10 PM

All replies

  • You need not double click. If there is no prefix before cell value then below should work.

    Basically you need to reassign the values to the range itself.

    In VBA it is like Range("Q24:Q60").Value=Range("Q24:Q60").Value


    Best Regards,
    Asadulla Javed,
    Jadavpore & Asansol

    Sunday, September 18, 2016 5:42 PM
    Answerer
  • >>>I'm trying to code with C# a script that  double click a range of cells. 

    According to your description, you could refer to below:

    1.Make the BeforeDoubleClick event public (for example this in Sheet1)
    Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
       'your coodes
    End Sub

    2.In your macro simply call this event function
    Sub Demo()
      Dim Rng As Range
      Set Rng = ActiveSheet.Range("Q24:Q60")
      Rng.Select
      Call Sheet1.Worksheet_BeforeDoubleClick(Selection, False)
    End Sub

    Monday, September 19, 2016 1:34 AM
  • Thanks for your answers. I try the first solution with no result in Visual Studio. I didn't try the second option because I found out another way making a conversion of units and exporting as a double instead of a string to solve my issue. Thanks for your time.
    • Proposed as answer by David_JunFeng Monday, September 26, 2016 2:18 PM
    • Marked as answer by David_JunFeng Monday, September 26, 2016 2:18 PM
    Monday, September 19, 2016 2:10 PM