VB coding needed

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
Dear Sir,
I have excel sheet named “ALL”. The sheet contains mostly numerical data. I find difficult in reading the numerical data with decimals in the cell. I do not want to magnify the whole sheet. I need the cell which is selected the data should be magnified to font size 13 (original font size in the sheet is 9)

Thanking you in advance,
RSEKAR
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.UsedRange.Font.Size = 9
Target.Font.Size = 13
End Sub
 
Upvote 0

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.UsedRange.Font.Size = 9
Target.Font.Size = 13
End Sub
Dear Sir,
VB coding is working fine. A small modification required that is the magnification should work if the cell in “E” column is selected.
Thanking you in advance,
RSEKAR
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column <> 5 Then Exit Sub
Intersect(Me.UsedRange, Columns("E")).Font.Size = 9
Target.Font.Size = 13
End Sub
 
Upvote 0

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
ADVERTISEMENT
Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column <> 5 Then Exit Sub
Intersect(Me.UsedRange, Columns("E")).Font.Size = 9
Target.Font.Size = 13
End Sub
Dear Sir,
No doubt it is working fine. It needs small correction that is as long as I am in the E column the cell is magnified to font size 13. When I leave to other column the last cell in E column from where I moved become magnified permanently which is corrected to default size when I return to some cell in E column again. It will be nice if the last cell in E column becomes to default font size when I come out of E column.
Thanking you in advance,
RSEKAR
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Apologies - I did not think this through. Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.UsedRange.Font.Size = 9
If Target.Column <> 5 Then Exit Sub
Target.Font.Size = 13
End Sub
 
Upvote 0

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
ADVERTISEMENT
Apologies - I did not think this through. Try

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.UsedRange.Font.Size = 9
If Target.Column <> 5 Then Exit Sub
Target.Font.Size = 13
End Sub
Dear Sir
Thanks a lot. It is working very fine.
Thanking you once again.
RSEKAR
 
Upvote 0

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
Dear Sir,
I have a problem in using your coding. Normally using a macro I copy data from other sheet and paste special value to this sheet named “ALL” where I use your coding. With your coding I am not able to use the macro to copy data to ALL sheet. The macro stops in the middle with error message. Without your coding the macro copy and paste to the ALL sheet with out any problem. Kindly suggest how I should run my macro with your coding in “ALL” sheet.
I use excel 2002.
Thanking you once again.
RSEKAR

Code:
Sub copy()
    Sheet2.Select
    Range("A10:H25").Select
    Selection.copy
    Sheets("ALL").Select
    Range("A10").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("C28").Select
    Application.CutCopyMode = False
   
End Sub
 
Upvote 0

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
38,154
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Dear Sir,
I have a problem in using your coding. Normally using a macro I copy data from other sheet and paste special value to this sheet named “ALL” where I use your coding. With your coding I am not able to use the macro to copy data to ALL sheet. The macro stops in the middle with error message. Without your coding the macro copy and paste to the ALL sheet with out any problem. Kindly suggest how I should run my macro with your coding in “ALL” sheet.
I use excel 2002.
Thanking you once again.
RSEKAR

Code:
Sub copy()
    Sheet2.Select
    Range("A10:H25").Select
    Selection.copy
    Sheets("ALL").Select
    Range("A10").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("C28").Select
    Application.CutCopyMode = False
   
End Sub
If you don't Select things before you work with them, you won't trigger the SelectionChange event...
Code:
Sub CopyIt()
  With Sheet2.Range("A10:H25")
    Sheets("ALL").Range("A10").Resize(.Rows.Count, .Columns.Count).Value = .Value
  End With
End Sub
 
Upvote 0

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
If you don't Select things before you work with them, you won't trigger the SelectionChange event...
Code:
Sub CopyIt()
  With Sheet2.Range("A10:H25")
    Sheets("ALL").Range("A10").Resize(.Rows.Count, .Columns.Count).Value = .Value
  End With
End Sub
Dear Sir,
Thanks a lot for your suggestion. I get one more problem in using your formula for copying that is Sheet2.Range("A10:H25") is from filtered rows. So copying is not done correctly as I expected. Kindly suggest any other method. The formula works well if the copying is done from a non filtered range.
Thanking you once again.
RSEKAR
 
Upvote 0

Forum statistics

Threads
1,195,635
Messages
6,010,823
Members
441,569
Latest member
PeggyLee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top