PIsabel
Board Regular
- Joined
- Feb 4, 2014
- Messages
- 126
- Office Version
- 365
- Platform
- Windows
Hello.
I need to run this code every 4 lines.
The sheets have either 4, 8, 16 or hundreds of lines but always in sets of 4 for each table.
Someone help me?
I need to run this code every 4 lines.
The sheets have either 4, 8, 16 or hundreds of lines but always in sets of 4 for each table.
Someone help me?
VBA Code:
Sub Range_To_Image()
Dim objChrt As Chart
Dim rngImage As Range
Dim strFile As String
On Error GoTo ErrExit
With Sheets("folha1") 'Tabellenname - Anpassen!
Set rngImage = .Range("A2:C5")
rngImage.CopyPicture Appearance:=xlScreen, Format:=xlBitmap
strFile = "C:\Users\Utilizador\Documents\. enviar\haus.jpg" 'Pfad und Dateiname für das Bild
Set objChrt = .ChartObjects.Add(rngImage.Left, rngImage.Top, rngImage.Width, rngImage.Height).Chart
With objChrt
.Parent.Activate 'to avoid exporting an empty file
.ChartArea.Format.Line.Visible = msoFalse 'remove border from chart
.Paste
.Export strFile
.Parent.Delete
End With
End With
ErrExit:
Set objChrt = Nothing
Set rngImage = Nothing
End Sub