Replicating code!!!!!!!!!!!!! Urgent!!!

S

stevie_ray

Hi there folks,

I am currently creating a student achievement spreadsheet and I a
using ticks in each cell to state if the student has passed the unit o
not.

I am using a simple VBA code to have any cell, within a specifie
range, ticked upon selecting it. If the cell within the specifie
range, already has a tick, the code will remove it. The trick to th
code is the use of the letter "a" in a cell that has had it's fon
formatted to marlett!!

My code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C13:AB13")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Sub

The code I am using presently works only on range C13:AB13 (i.e. on
horizontal row). However, I am looking at coping the formula down th
rows (i.e. C14:AB14, C15:AB15.............)

I have attempted to copy and paste the initial formula and ad
different parameters but to no avail. What am I doing wrong?

Mar
 
I

icestationzbra

my understanding was that you wanted the range("c13:ab13") to chang
dynamically. am i right?

if yes, then try this variation of your code.

if not, revert with a little more detail that might of help to analys
your problem.

Option Explicit

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim rngRow As Range

If Target.Cells.Count > 1 Then Exit Sub
Set rngRow = Target.EntireRow

If Not Intersect(Target, rngRow) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Su
 
D

Dave Peterson

And see one more reply at your other post.


stevie_ray < said:
Hi there folks,

I am currently creating a student achievement spreadsheet and I am
using ticks in each cell to state if the student has passed the unit or
not.

I am using a simple VBA code to have any cell, within a specified
range, ticked upon selecting it. If the cell within the specified
range, already has a tick, the code will remove it. The trick to the
code is the use of the letter "a" in a cell that has had it's font
formatted to marlett!!

My code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("C13:AB13")) Is Nothing Then
Target.Font.Name = "Marlett"
If Target = vbNullString Then
Target = "a"
Else
Target = vbNullString
End If
End If
End Sub

The code I am using presently works only on range C13:AB13 (i.e. one
horizontal row). However, I am looking at coping the formula down the
rows (i.e. C14:AB14, C15:AB15.............)

I have attempted to copy and paste the initial formula and add
different parameters but to no avail. What am I doing wrong?

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top