반응형

50290 런타임 오류가 발생하였습니다

 

처음 보는 오류이다.

 

원인이 무엇인지 모르겠다.

반응형

'엑셀' 카테고리의 다른 글

COMPLEX NUMBERS IN EXCEL  (0) 2023.06.26
대각선 셀의 합 구하기  (0) 2023.06.19
엑셀 복사 붙여넣기 중 멈춤 현상  (0) 2023.06.19
엑셀함수 이정도는 알고 쓰자  (0) 2023.05.28
THANKYOU  (0) 2023.05.25
반응형

언젠가 부터 계속 복사하여 붙여넣기를 하는데 도중에 계속 엑셀이 멈춘다.

 

인터넷에 찾아보니 몇가지 방법이 있다고 하는데

 

1. COM추가기능을 삭제한다.

내 컴퓨터에는 다음과 같은 COM 추가 기능이 설치되어 있다.

근데 체크가 되어 있지 않아 사용하지 않는 것 같은데...

하나씩 체크 해제하고 문제가 발생하는지 확

 

2. 하드웨어 그래칙 가속 사용 안 함. 체크

 

3. 잘라내기/복사/붙여넣기

콘텐츠를 붙여넣을 때 붙여넣기 옵션 단추 표시(S) 체크 해제

 

4. 사용자 인터페이스 옵션

실시간 미리 보기 사용(L) 체크 해제

 

구글에 검색해 보니 

https://www.makeuseof.com/fix-excel-freezes-copy-paste/

 

반응형

'엑셀' 카테고리의 다른 글

대각선 셀의 합 구하기  (0) 2023.06.19
50290 런타임 오류가 발생하였습니다  (0) 2023.06.19
엑셀함수 이정도는 알고 쓰자  (0) 2023.05.28
THANKYOU  (0) 2023.05.25
Look up in table  (0) 2023.05.25
반응형

Mohr's circle VBA code by ChatGPT

 

Sub CreateMohrsCircle()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1") ' Replace "Sheet1" with your worksheet name
    
    ' Input variables
    Dim sigma_x As Double
    Dim sigma_y As Double
    Dim tau_xy As Double
    
    ' Prompt the user to enter the values
    sigma_x = InputBox("Enter sigma_x:")
    sigma_y = InputBox("Enter sigma_y:")
    tau_xy = InputBox("Enter tau_xy:")
    
    ' Calculate the center and radius of the circle
    Dim sigma_avg As Double
    sigma_avg = (sigma_x + sigma_y) / 2
    
    Dim R As Double
    R = ((sigma_x - sigma_y) ^ 2 + (2 * tau_xy) ^ 2) ^ 0.5 / 2
    
    ' Calculate the angle of rotation
    Dim theta As Double
    theta = 0.5 * WorksheetFunction.Atan(2 * tau_xy / (sigma_x - sigma_y))
    
    ' Clear previous data and labels
    ws.Range("A1:F20").ClearContents
    
    ' Draw the circle
    Dim angle As Double
    Dim point_x As Double
    Dim point_y As Double
    
    For angle = 0 To 2 * WorksheetFunction.Pi Step 0.01
        point_x = sigma_avg + R * Cos(angle - theta)
        point_y = R * Sin(angle - theta)
        
        ws.Cells(Round(point_y) + 11, Round(point_x) + 11).Value = "•"
    Next angle
    
    ' Draw axes and labels
    ws.Range("E11:F11").Value = Array("σ", "τ")
    ws.Range("J11:K11").Value = Array("σ", "-τ")
    ws.Range("G6:H6").Value = Array("σ_x", "τ_xy")
    ws.Range("I6").Value = sigma_x
    ws.Range("J7").Value = -tau_xy
    
    ' Draw the center and radius
    ws.Cells(11, sigma_avg + 11).Value = "•"
    ws.Range("J12:K12").Value = Array("Center:", "Radius:")
    ws.Range("J13").Value = sigma_avg
    ws.Range("K13").Value = R
    
    ' Format the circle and labels
    With ws.Range("A1:F20")
        .HorizontalAlignment = xlCenter
        .Font.Name = "Arial"
        .Font.Size = 8
    End With
    
    With ws.Range("E11:F11", "J13:K13")
        .Font.Bold = True
    End With
    
    ' Adjust column widths and row heights
    ws.Columns("A:F").ColumnWidth = 2
    ws.Columns("G:K").ColumnWidth = 8
    ws.Rows("1:10").RowHeight = 12
End Sub

To use this code, follow these steps:

  1. Open your Excel workbook and press Alt+F11 to open the VBA Editor.
  2. Insert a new module by clicking on "Insert" > "Module."
  3. Copy and paste the code into the new module.
  4. Modify the worksheet name in the line Set ws = ThisWorkbook.Sheets("Sheet1") to match your desired worksheet name.
  5. Save the workbook and close the VBA Editor.
  6. Press Alt+F8 to open the "Macro" dialog box.
  7. Select the "CreateMohrsCircle" macro and click "Run."
  8. The macro will prompt you to enter the values of sigma_x, sigma_y, and tau_xy in separate input boxes.
  9. Enter the values and click "OK."
  10. The Mohr's circle will be created on the specified worksheet with the entered values.

Please note that this code assumes you have a worksheet named "Sheet1" where the Mohr's circle will be created. Modify the code accordingly if you want to use a different worksheet name or if you want to adjust the layout or formatting of the circle.

Additionally, the code currently draws the Mohr's circle using text-based symbols ('•') in the worksheet. If you prefer a graphical representation, you can use VBA to create a scatter plot or utilize Excel's built-in charting features to display the circle. Let me know if you would like assistance with that aspect as well.

 

 

 

Sub CreateMohrsCircle()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Sheet1") ' Replace "Sheet1" with your worksheet name
    
    ' Input variables
    Dim sigma_x As Double
    Dim sigma_y As Double
    Dim tau_xy As Double
    
    ' Prompt the user to enter the values
    sigma_x = InputBox("Enter sigma_x:")
    sigma_y = InputBox("Enter sigma_y:")
    tau_xy = InputBox("Enter tau_xy:")
    
    ' Calculate the center and radius of the circle
    Dim sigma_avg As Double
    sigma_avg = (sigma_x + sigma_y) / 2
    
    Dim R As Double
    R = ((sigma_x - sigma_y) ^ 2 + (2 * tau_xy) ^ 2) ^ 0.5 / 2
    
    ' Calculate the angle of rotation
    Dim theta As Double
    theta = 0.5 * WorksheetFunction.Atan(2 * tau_xy / (sigma_x - sigma_y))
    
    ' Clear previous data and labels
    ws.Range("A1:F20").ClearContents
    
    ' Draw the circle
    Dim angle As Double
    Dim point_x As Double
    Dim point_y As Double
    
    For angle = 0 To 2 * WorksheetFunction.Pi Step 0.01
        point_x = sigma_avg + R * Cos(angle - theta)
        point_y = R * Sin(angle - theta)
        
        ws.Cells(Round(point_y) + 11, Round(point_x) + 11).Value = "•"
    Next angle
    
    ' Draw axes and labels
    ws.Range("E11:F11").Value = Array("σ", "τ")
    ws.Range("J11:K11").Value = Array("σ", "-τ")
    ws.Range("G6:H6").Value = Array("σ_x", "τ_xy")
    ws.Range("I6").Value = sigma_x
    ws.Range("J7").Value = -tau_xy
    
    ' Draw the center and radius
    ws.Cells(11, sigma_avg + 11).Value = "•"
    ws.Range("J12:K12").Value = Array("Center:", "Radius:")
    ws.Range("J13").Value = sigma_avg
    ws.Range("K13").Value = R
    
    ' Format the circle and labels
    With ws.Range("A1:F20")
        .HorizontalAlignment = xlCenter
        .Font.Name = "Arial"
        .Font.Size = 8
    End With
    
    With ws.Range("E11:F11", "J13:K13")
        .Font.Bold = True
    End With
    
    ' Adjust column widths and row heights
    ws.Columns("A:F").ColumnWidth = 2
    ws.Columns("G:K").ColumnWidth = 8
    ws.Rows("1:10").RowHeight = 12
    
    ' Create a scatter plot chart
    Dim cht As ChartObject
    Set cht = ws.ChartObjects.Add(Left:=ws.Cells(1, 8).Left, Top:=ws.Cells(1, 8).Top, Width:=400, Height:=300)
    
    With cht.Chart
        ' Add a scatter plot series
        .SeriesCollection.NewSeries
        .SeriesCollection(1).Name = "Mohr's Circle"
        .SeriesCollection(1).XValues = ws.Range("A11:A31")
        .SeriesCollection(1).Values
        .SeriesCollection(1).Values = ws.Range("B11:B31")
        
        ' Set chart type and style
        .ChartType = xlXYScatter
        .ChartStyle = 8 ' Adjust the chart style as desired
        
        ' Set axis labels
        .Axes(xlCategory).HasTitle = True
        .Axes(xlCategory).AxisTitle.Text = "σ"
        .Axes(xlValue).HasTitle = True
        .Axes(xlValue).AxisTitle.Text = "τ"
        
        ' Set axis scales
        .Axes(xlCategory).MinimumScale = sigma_avg - R
        .Axes(xlCategory).MaximumScale = sigma_avg + R
        .Axes(xlValue).MinimumScale = -R
        .Axes(xlValue).MaximumScale = R
        
        ' Set chart title
        .HasTitle = True
        .ChartTitle.Text = "Mohr's Circle"
    End With
End Sub

After running the modified code, a scatter plot chart representing the Mohr's circle will be created in the specified worksheet. The chart will display the σ values on the x-axis and the τ values on the y-axis. The axis scales and titles will be set accordingly. You can adjust the chart style, axis labels, or other formatting options as desired.

Remember to modify the worksheet name in the line Set ws = ThisWorkbook.Sheets("Sheet1") to match your desired worksheet name.

Let me know if you need further assistance!

반응형

'VBA' 카테고리의 다른 글

VBA를 사용하여 X 축과 Y 축의 범위 값을 가져오기  (0) 2023.06.14
엑셀 차트크기 조절 VBA  (0) 2023.04.04
셀 값이 0인 경우 해당 셀 값 삭제  (0) 2023.02.21
열너비 바꾸는 VBA  (0) 2023.02.20
데이터 정렬하기  (0) 2023.02.17

+ Recent posts