CupDeal

Hi, Friends this is blog about Trending Views

About CupDeal


Thursday, 22 March 2018

Fit Image VBA Code for Excel File

Fit Image VBA Code for Excel File
फिट इमेज vba एक्सेल कोड कॉपी पेस्ट करे और use करे बहुत आसान|




Public Sub FitPic()
On Error GoTo NOT_SHAPE
Dim PicWtoHRatio As Single
Dim CellWtoHRatio As Single
With Selection
PicWtoHRatio = .Width / .Height
End With
With Selection.TopLeftCell
CellWtoHRatio = .Width / .RowHeight
End With
Select Case PicWtoHRatio / CellWtoHRatio
Case Is > 1
With Selection
.Width = .TopLeftCell.Width
.Height = .Width * PicWtoHRatio
End With
Case Else
With Selection
.Height = .TopLeftCell.RowHeight
.Width = .Height * PicWtoHRatio
End With
End Select
With Selection
.Top = .TopLeftCell.Top
.Left = .TopLeftCell.Left
End With
Exit Sub
NOT_SHAPE:
MsgBox "Select a picture before running this macro."
End Sub


2 comments:

MI 4A "Search Filpkart Product"