Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default insert Worksheet_SelectionChange(ByVal Target As Range) through vba

Thanks for the offer of assistance. I will play with DoEvents.

I am inserting a sample of what I do have. I am sure you realize this
is called from another procedure and their are other things going on.
And since I have only learned this by trial and error my code may not
be written very well.

Sub Record_SKUs()

Dim VBCodeMod As CodeModule
Dim LineNum As Long
Set VBCodeMod =
ActiveWorkbook.VBProject.VBComponents("Sheet1").Co deModule
With VBCodeMod
LineNum = .CountOfLines + 1
.InsertLines LineNum, _
"Public ad_str, frm_ad" & Chr(13) & _
"" & Chr(13) & _
"Private Sub Worksheet_SelectionChange(ByVal Target As Range)" &
Chr(13) & _
"Dim tmpObj, strObj" & Chr(13) & _
"On Error Resume Next" & Chr(13) & _
"strObj = frm_ad" & Chr(13) & _
"If ActiveCell.Column = 7 Then" & Chr(13) & _
"Range(strObj).Offset(0, 7) = Left(ad_str, 3) & ""0""" & Chr(13) & _
"Range(strObj).Offset(0, 8) = Right(ad_str, 5)" & Chr(13) & _
"End If" & Chr(13) & _
"If ActiveCell.Column = 7 And ActiveCell.Row < 1 Then" & Chr(13) & _
"ad_str = ActiveCell" & Chr(13) & _
"frm_ad = ActiveCell.Address" & Chr(13) & _
"End If" & Chr(13) & _
"End Sub"
End With
End Sub


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
Worksheet_SelectionChange(ByVal Target As Range) questions Gary Keramidas[_4_] Excel Programming 2 October 2nd 05 10:31 AM
Ranges:Target in Worksheet_SelectionChange(ByVal Target As Range) Kevin McCartney Excel Programming 3 April 15th 05 01:51 PM
ByVal Target As Range monir Excel Programming 4 April 12th 05 04:37 PM
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Arturo Excel Programming 2 January 7th 05 06:59 PM
what does (ByVal Target As Range) mean Zygoid[_7_] Excel Programming 6 January 31st 04 05:08 PM


All times are GMT +1. The time now is 08:42 AM.

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

About Us

"It's about Microsoft Excel"