'Stretching my excel charts even when not targeting the sheet
I dont understand why it's happening. I'm using a code that checks another sheet, yet my sheet("visualisation") is being affected. Why is that? It's squeezing all my charts...
here is the line :
lastrow1 = Sheets("SharePoint").Cells(Sheets("SharePoint").Rows.Count, Cells(1, 1).Column).End(xlUp).Row
This is the entire code:
Sub Start()
Dim name As String
Dim name1 As String
Dim numb As String
Dim name3 As String
Dim lastrow1 As Long
Dim lastrow2 As Long
Dim lastrow3 As Long
Dim x As String
Columns(7).EntireColumn.Delete
Columns(8).EntireColumn.Delete
t = 167
lastrow1 = Sheets("SharePoint").Cells(Sheets("SharePoint").Rows.Count, Cells(1, 1).Column).End(xlUp).Row 'Determining the last row of a worksheet 1
lastrow2 = Sheets("GIC").Cells(Sheets("GIC").Rows.Count, Cells(1, 1).Column).End(xlUp).Row 'Determining the last row of a worksheet 2
lastrow3 = Sheets("VALUE").Cells(Sheets("VALUE").Rows.Count, Cells(1, 1).Column).End(xlUp).Row 'Determining the last row of a worksheet 3
For i = 2 To lastrow1
name = Sheets("SharePoint").Range("A" & i & ":" & "A" & i).Value
name3 = Sheets("SharePoint").Range("C" & i & ":" & "C" & i).Value
numb = Sheets("SharePoint").Range("B" & i & ":" & "B" & i).Value
For m = 1 To lastrow3
If name = Sheets("VALUE").Cells(m, 1).Value Then
name1 = Sheets("VALUE").Cells(m, 2).Value
Exit For
End If
Next
For q = 2 To lastrow2
If name1 = Sheets("GIC").Range("A" & q & ":" & "A" & q).Value Then
If numb = Sheets("GIC").Range("B" & q & ":" & "B" & q).Value Then
ind = 0
Exit For
End If
ind = 1
Else
ind = 1
End If
Next
If ind = 1 Then
Sheets("visualisation").Cells(t, 7).Value = name
Sheets("visualisation").Cells(t, 8).Value = numb
Sheets("visualisation").Cells(t, 9).Value = name3
Sheets("visualisation").Cells.EntireColumn.AutoFit
t = t + 1
ind = 0
End If
Next
End Sub
"Visualisation" is the sheet where the charts are being squeezed.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|