Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default There has got to be away!?


I have the following code:


Code:
--------------------

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("income").EntireColumn.Insert
Range("d11").Formula = TextBox1.Value
Else
Range("expense").EntireColumn.Insert
Range("f11").Formula = TextBox1.Value
End If
Unload Me
End Sub

Private Sub OptionButton1_Click()
Me.OptionButton1.Value = True
End Sub

--------------------


I want to make sure that the newly inserted column is always placed in
front of either the 'income' column or in front of the 'expense'
column depending on what is choosen by the option buttons. I also want
the textbox to label that new column.

I know that the problem is in the 'Range("f11").Formula =
Textbox1.Value' portion of my code but I do not know how to make this
code follow the name range and always insert the column in front of it
with the textbox given name.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=401968

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default There has got to be away!?

Worksheets("Sheet1").Cells(11, Range("interest").Column - 1).Formula =
TextBox1.Value

and

Worksheets("Sheet1").Cells(11, Range("expense").Column - 1).Formula =
TextBox1.Value

Replace Sheet1 with the appropriate sheet if not Sheet1

Replace 11 with whatever row # you want the heading to be in.
If that row varies, then use a formula for the row as well as the column.
You can also use Offset

Jon




"oberon.black"
wrote in message
news:oberon.black.1uwdyc_1125943508.8858@excelforu m-nospam.com...

I have the following code:


Code:
--------------------

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("income").EntireColumn.Insert
Range("d11").Formula = TextBox1.Value
Else
Range("expense").EntireColumn.Insert
Range("f11").Formula = TextBox1.Value
End If
Unload Me
End Sub

Private Sub OptionButton1_Click()
Me.OptionButton1.Value = True
End Sub

--------------------


I want to make sure that the newly inserted column is always placed in
front of either the 'income' column or in front of the 'expense'
column depending on what is choosen by the option buttons. I also want
the textbox to label that new column.

I know that the problem is in the 'Range("f11").Formula =
Textbox1.Value' portion of my code but I do not know how to make this
code follow the name range and always insert the column in front of it
with the textbox given name.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:
http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=401968



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default There has got to be away!?

The 1st line in the above post should have the range name "income".

Jon
"Jon" wrote in message
news:jE1Te.255915$on1.110091@clgrps13...
Worksheets("Sheet1").Cells(11, Range("interest").Column - 1).Formula =
TextBox1.Value

and

Worksheets("Sheet1").Cells(11, Range("expense").Column - 1).Formula =
TextBox1.Value

Replace Sheet1 with the appropriate sheet if not Sheet1

Replace 11 with whatever row # you want the heading to be in.
If that row varies, then use a formula for the row as well as the column.
You can also use Offset

Jon




"oberon.black"
wrote in message
news:oberon.black.1uwdyc_1125943508.8858@excelforu m-nospam.com...

I have the following code:


Code:
--------------------

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("income").EntireColumn.Insert
Range("d11").Formula = TextBox1.Value
Else
Range("expense").EntireColumn.Insert
Range("f11").Formula = TextBox1.Value
End If
Unload Me
End Sub

Private Sub OptionButton1_Click()
Me.OptionButton1.Value = True
End Sub

--------------------


I want to make sure that the newly inserted column is always placed in
front of either the 'income' column or in front of the 'expense'
column depending on what is choosen by the option buttons. I also want
the textbox to label that new column.

I know that the problem is in the 'Range("f11").Formula =
Textbox1.Value' portion of my code but I do not know how to make this
code follow the name range and always insert the column in front of it
with the textbox given name.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:
http://www.excelforum.com/member.php...o&userid=26732
View this thread:
http://www.excelforum.com/showthread...hreadid=401968





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default There has got to be away!?


ok but where should this be put into my current code? Or how should
this be added to my current code?


Code:
--------------------

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("income").EntireColumn.Insert
Range("d11").Formula = TextBox1.Value
Else
Range("expense").EntireColumn.Insert
Range("f11").Formula = TextBox1.Value
End If
Unload Me
End Sub

Private Sub OptionButton1_Click()
Me.OptionButton1.Value = True
End Sub


--------------------


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=401968

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default There has got to be away!?


Thank you so much I figured it out. You guys are great.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=401968



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



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

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"