Bolding cell

TeacherEric

Board Regular
Joined
Mar 21, 2006
Messages
78
Hello all,

I'm stumped... so of course I turn to you guys for the answers. :)

Now that you're good and buttered... :cool:

This is the code I want to run then kept ready (like a TSR).

Every time I move cells the code will run.

The code should start and stop with 1 particular sheet only, not the entire workbook.


Thank you
TeacherEric

Code:
restart:
Dim a As String
Dim b As String

a = ActiveCell.Row
b = ActiveCell.Address
If ActiveCell.Row > 8 Then

' This code should only run if the active ROW is 9 - 63
' the sheet is protected, so no need to validate columns

Range("A" & a & ":" & "C" & a).Select
Selection.Characters.Font.Bold = True
Selection.Characters.Font.Size = 14
Range(b).Select
If ActiveCell.Address <> b Then
Range("A" & a).Characters.Font.Bold = False
Range("A" & a).Characters.Font.Size = 10
GoTo restart

End If
End If
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Jindon and Harvey, thank you very much.

I'm going to use Harvey's code only because it doens't make the screen flicker when I change cells - it's more fluid.

I have one problem now, and I might be knocking on Excel's limitation door for this one.

Without the code in place, I can do a copy and pastespecial. With the code in place, I can do a copy, but I can't do a paste. :(

It's imperative that I be able to do a pastespecial.

The only time a pastespecial will be used is with an autoshape code.

The code I wrote to do the job is below.

Can either of these codes be tweaked to allow me to run this other code?
Or is there no possible way to have both?


These codes are not related to one another. The first code you wrote should always be active. This second code below is used only when the autoshape is clicked.

Thank you both again!
TeacherEric

SECOND CODE - AUTO FILL IN FOR GRADES (ATTENDANCE).


Code:
Sub autofillscores1()
Dim n As String
Dim m As String
Dim o As String
Dim p As String
Dim y As String
Dim z As String

Application.ScreenUpdating = False

startit:
n = ActiveCell.Value
m = ActiveCell.Offset(-1, 0).Address
p = ActiveCell.Offset(1, 0).Row
y = ActiveCell.Row
z = ActiveCell.Column
o = ActiveCell.Address



If z < 4 Or z > 54 Then GoTo warning
If y < 9 Or y > 63 Then GoTo warning


If y = 9 Then ActiveCell.Offset(1, 0).Select
If y = 9 Then GoTo startit

If n > "0" Then GoTo overwritemessage

continue:

Range(m).Select
Selection.Copy
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

ActiveCell.Offset(1, 0).Select


If Range("a" & p).Value <> "0" Then GoTo startit
If Range("a" & p).Value = "0" Then GoTo done

endit:
Application.ScreenUpdating = True
GoTo finished
overwritemessage:
Application.CutCopyMode = False
Application.ScreenUpdating = True
Range(o).Select
MsgBox "Oops!  You have a score for this student already, STOPPING!" & vbCr & "                                  Fill did not complete!" & vbCr & "" & _
vbCr & "                              Please check your grades.", , "Check Your Grades."
GoTo endit
done:
MsgBox "  Scores are entered, Done."
GoTo endit
warning:
MsgBox "Oops! Make sure your within the grading area" & _
vbCr & "    before you click FILL IT."
GoTo endit

finished:
Application.CutCopyMode = False
End Sub
 
Upvote 0
"Select" in your code triggers SelectionChange event, so it clears clip board.

Add

Application.EnableEvents = False before you "Select" and add
Application.EnableEvents = True after you finish pasting

BTW, if you don't like the screen to flicker try
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
With Range("a:c")
   .Font.Bold = False
   .Font.Size = 10
End With
With Range("a" & Target.Row).Resize(,3)
   .Font.Bold = True
   .Font.Size = 14
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,061
Messages
6,122,922
Members
449,094
Latest member
teemeren

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
Back
Top