Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - making an exception for certain cells

Hello there,

I have a piece of VBA code that I have been using in a mock up excel
system for my A levels

the code places the cell number + and offset of 113 into the cell you
click on in coloumb B. Sort of working like an auto number in the next
cell. But i dont want it to do this for rows 1 -5 is there anyway of
doing this?

Heres the code;

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim RowOffset As Long
Dim IndexCol As String

RowOffset = 113

IndexCol = "B"

Intersect(ActiveCell.EntireRow, Columns(IndexCol)).Value =
ActiveCell.Row + RowOffset
End Sub

Any help would be greatly appreciated
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default VBA - making an exception for certain cells

try this-

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Range
For Each Cell In Target
If Cell.Row 5 Then
Cells(Cell.Row, "B").Value = Cell.Row + 113
End If
Next
End Sub

"badboybmw_886" wrote in message
...
| Hello there,
|
| I have a piece of VBA code that I have been using in a mock up excel
| system for my A levels
|
| the code places the cell number + and offset of 113 into the cell you
| click on in coloumb B. Sort of working like an auto number in the next
| cell. But i dont want it to do this for rows 1 -5 is there anyway of
| doing this?
|
| Heres the code;
|
| Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
| Dim RowOffset As Long
| Dim IndexCol As String
|
| RowOffset = 113
|
| IndexCol = "B"
|
| Intersect(ActiveCell.EntireRow, Columns(IndexCol)).Value =
| ActiveCell.Row + RowOffset
| End Sub
|
| Any help would be greatly appreciated

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception from HRESULT: 0x800A03EC - COM Exception Unhandled Karthizen[_2_] Excel Programming 3 March 16th 09 09:54 PM
Exception in Activating Subscription Cells Ostate Excel Discussion (Misc queries) 1 May 22nd 07 07:38 AM
"Exception in Activating Subscription Cells" Ostate Excel Discussion (Misc queries) 0 May 20th 07 03:03 PM
Exception in Activating Subscription cells Ostate Excel Discussion (Misc queries) 0 May 19th 07 05:56 PM
can a sheet be locked, with exception of some cells in it Shariq Excel Discussion (Misc queries) 1 January 2nd 07 01:20 PM


All times are GMT +1. The time now is 07:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"