#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Code Help

I am trying to develop code so that on the event that a1 is not blank the
cursor will go to B2 and take $A$1*B1. Then move over one cell to C2 and
take $A$1*C1 out to a100.

So far I have;


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Address = "$A$1" Then
Application.EnableEvents = False
If Target.Value < """" Then
'Need Help with Code"

End If
Application.EnableEvents = True
End If

End Sub

As always, thanks a lot for any help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Code Help

Hi,
do you mean you want to apply a formula to B2:C100 ?

If so
Range("B2:C100").formula= "=$A$1*B1"
-- this will apply the formula string to B2 and update the string for all
other cells, ie in B2, the 'B1' portion of the formula becomes 'C1'

Now, if you only want values for the final (no formula), add the code:
Range("B2:C100").Copy
Range("B2:C100").pastespecial xlPasteValues
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"Ronbo" wrote:

I am trying to develop code so that on the event that a1 is not blank the
cursor will go to B2 and take $A$1*B1. Then move over one cell to C2 and
take $A$1*C1 out to a100.

So far I have;


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Address = "$A$1" Then
Application.EnableEvents = False
If Target.Value < """" Then
'Need Help with Code"

End If
Application.EnableEvents = True
End If

End Sub

As always, thanks a lot for any help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Code Help

I think you want to change

If Target.Value < """"

To

If Target.Value < ""

You are testing to see if the cell contains a quote " , not blank as you
stated.


"Ronbo" wrote:

I am trying to develop code so that on the event that a1 is not blank the
cursor will go to B2 and take $A$1*B1. Then move over one cell to C2 and
take $A$1*C1 out to a100.

So far I have;


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Target.Address = "$A$1" Then
Application.EnableEvents = False
If Target.Value < """" Then
'Need Help with Code"

End If
Application.EnableEvents = True
End If

End Sub

As always, thanks a lot for any help.

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
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


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

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"