I want to select a number of cells, temporarily make changes as noted below, and show the changes in a format such as a picture in this case.
CHANGE 1: Change the dot character "." with a hashtag "#".
CHANGE 2: [Preamble: Assume all characters have a weighting of 1 except the hashtag character "#" which has a weighting of 0.5. So when counting the number of characters, 2 of "#" equal 1 of any other character.] .......... Then colour each character green if the count of that character is a whole number (for weighting of 1 and 0.5 respectively) or an even whole number (for weighting of 2 and 1 respectively). Otherwise colour red.
The code below is a work in progress and based on a sample from elsewhere. It does not incorporate Change 2.
* Note that when the code is run, the image width is only the size of the column and may not fit the total number of characters. Is there a way to make it fit the entire length of the data. Maybe a completely different method to display the data as opposed to the current method?
EXAMPLE
Cell data
a+b + ..1-jmq. - qw.erty
d-k .2np. 2k2m..j3
h+j .582. 2k2m...jk
Image required when macro is run
a+b + ##1-jmq# - qw#erty
d-k #2np# 2k2m##j3
h+j #582# 2k2m###jk
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
ZoomCell 1.75
End Sub
Private Sub ZoomCell(ZoomIn As Single)
Dim s As Range
Set s = Selection
'Get rid of any existing zoom pictures
For Each p In ActiveSheet.Pictures
If p.Name = "ZoomCell" Then
p.Delete
Exit For
End If
Next
'Create a zoom picture
Dim c As Range, x As Long
For Each c In Selection
Dim result As String
c = Replace(c, ".", "#")
Next
s.CopyPicture Appearance:=xlScreen, Format:=xlPicture
ActiveSheet.Pictures.Paste.Select
With Selection
.Name = "ZoomCell"
With .ShapeRange
.ScaleWidth ZoomIn, msoFalse, msoScaleFromTopLeft
.ScaleHeight ZoomIn, msoFalse, msoScaleFromTopLeft
With .Fill
.ForeColor.SchemeColor = 8
.Visible = msoTrue
.Solid
.Transparency = 0.75
End With
End With
End With
s.Select
Set s = Nothing
For Each c In Selection
c = Replace(c, "#", ".") 'Reverts back to original once deselected
Next
End Sub
Bookmarks