Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


I have the following code attach to my command button:


Code
-------------------

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname").Column - 1).Formula = TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname").Column - 1).Value = CDbl(Calendar1.Value)
Else
Range("cellname2").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname2").Column - 1).Formula = TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname2").Column - 1).Value = CDbl(Calendar1.Value)
End If
Unload Me
End Sub

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


This code allows me to create a column in front of my 'cellname' colum
and puts the text I add to 'textbox1' at the top of that column with th
date I enter on my calendar.

-Problem-
I have added some extra textboxex to my userform that will allow me t
enter text into specified cells in my worksheet using this code:


Code
-------------------

range("C10").value = textbox2.text

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


I want to add this code to the code above and I want the range cel
range code to stay with the insert colum code.

So that evrytime I add a new column the text that I enter in t
'textbox2' will go to cell 'c10' in the new column that was jus
added.

Please help me with this code.

Thank you for your suppor

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=46838

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


Still looking for some help on this one.


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


Still Looking for some help on this on

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=46838

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


still aroun

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=46838

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


still need help


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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


Good afternoon oberon.black

Does this help your cause...?

Cells(1, ActiveCell.Column).Value = TextBox2.Text

HTH

Dominic

--
dominic
-----------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...fo&userid=1893
View this thread: http://www.excelforum.com/showthread.php?threadid=46838

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Modify Command Button

I expect the reason you have not had an answer is becouse it is not clear
what your problem is.

range("C10").value = textbox2.text


That should work just fine, eg

Private Sub TextBox2_Change()
Range("C10").Value = TextBox2.Text
End Sub

or

Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Range("C10").Value = TextBox2.Text
End Sub

Regards,
Peter T


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

I have the following code attach to my command button:


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

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname").Column - 1).Formula =

TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname").Column - 1).Value =

CDbl(Calendar1.Value)
Else
Range("cellname2").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname2").Column - 1).Formula =

TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname2").Column - 1).Value =

CDbl(Calendar1.Value)
End If
Unload Me
End Sub

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


This code allows me to create a column in front of my 'cellname' column
and puts the text I add to 'textbox1' at the top of that column with the
date I enter on my calendar.

-Problem-
I have added some extra textboxex to my userform that will allow me to
enter text into specified cells in my worksheet using this code:


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

range("C10").value = textbox2.text

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


I want to add this code to the code above and I want the range cell
range code to stay with the insert colum code.

So that evrytime I add a new column the text that I enter in to
'textbox2' will go to cell 'c10' in the new column that was just
added.

Please help me with this code.

Thank you for your support


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:

http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=468385



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


OK maybe I was not clear on what I am trying to do.


I want to add this code (A) :

***'x' is being used as a variable***


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

range("x10").value = textbox2.text

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


to this code (B):


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

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname").Column - 1).Formula = TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname").Column - 1).Value =
CDbl(Calendar1.Value)
Else
Range("cellname2").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname2").Column - 1).Formula =
TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname2").Column - 1).Value =
CDbl(Calendar1.Value)
End If
Unload Me
End Sub

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


So that the information that is entered into textbox2 will go into the
new column that is created by code (B). Therefore everytime I add a new
column using code (B) range(x) will be equal to textbox2 and be placed
in that new column.

Example

I run code (B) and it creates column 'D'. I want the info that I put in
textbox2 to be entered in 'D10'. Then if I run code (B) again and it
creates column 'E' I want the info that I enter into textbox2 to be
entered into 'E10' and so on. So that everytime I run code(B) the
information in textbox to will be entered in to the newcolumn and into
row 10 of that column.

I hope this is a clearer explanation of what I am trying to do.

Please help me develope this code.

Thank you for your support.


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

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


still need help resolving this issue


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

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Modify Command Button

Is this what you are looking for -

Dim nCol as long

If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
nCol = Range("cellname").Column
'code
Else
Range("cellname2").EntireColumn.Insert
nCol = Range("cellname2").Column
'code
End if

Cells(10,nCol).value = textbox2.text

You might need to qualify Cells(10,nCol) with whatever worksheet ("CGS" ?)
if not the active sheet.

Regards,
Peter T

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

OK maybe I was not clear on what I am trying to do.


I want to add this code (A) :

***'x' is being used as a variable***


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

range("x10").value = textbox2.text

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


to this code (B):


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

Private Sub CommandButton1_Click()
If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname").Column - 1).Formula =

TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname").Column - 1).Value =
CDbl(Calendar1.Value)
Else
Range("cellname2").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname2").Column - 1).Formula =
TextBox1.Value
Worksheets("CGS").Cells(10, Range("cellname2").Column - 1).Value =
CDbl(Calendar1.Value)
End If
Unload Me
End Sub

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


So that the information that is entered into textbox2 will go into the
new column that is created by code (B). Therefore everytime I add a new
column using code (B) range(x) will be equal to textbox2 and be placed
in that new column.

Example

I run code (B) and it creates column 'D'. I want the info that I put in
textbox2 to be entered in 'D10'. Then if I run code (B) again and it
creates column 'E' I want the info that I enter into textbox2 to be
entered into 'E10' and so on. So that everytime I run code(B) the
information in textbox to will be entered in to the newcolumn and into
row 10 of that column.

I hope this is a clearer explanation of what I am trying to do.

Please help me develope this code.

Thank you for your support.


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:

http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=468385





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


So Should the new code look like this:


Code
-------------------

Private Sub CommandButton1_Click()
Dim nCol as long

If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname").Column - 1).Formula =
TextBox1.Value
nCol = Range("cellname").Column
Worksheets("CGS").Cells(10, Range("cellname").Column - 1).Value =
CDbl(Calendar1.Value)
Else
Range("cellname2").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname2").Column - 1).Formula =
TextBox1.Value
nCol = Range("cellname2").Column
Worksheets("CGS").Cells(10, Range("cellname2").Column - 1).Value =
CDbl(Calendar1.Value)
End If

Cells(10,nCol).value = textbox2.text

Unload Me
End Sub

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


I have no idea how this code should be written.

Please help me get this code written up correctly.

Thank you for your suppor

--
oberon.blac
-----------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...fo&userid=2673
View this thread: http://www.excelforum.com/showthread.php?threadid=46838

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Modify Command Button


still struggling with this


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

  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Modify Command Button

Based on my understanding of what you want are trying to achieve the code
might indeed look something like what you posted below.

My understanding was that you want to place textbox2.text in row 10 of the
column number of the named cell, which may be repositioned following a
column insert. The named cell being either cellname or cellname2 depending
on the If evaluation.

In the years I've been following this ng I don't think I've ever seen anyone
bump their own post 6 times in 24hrs. Must be some kind of record!

Regards,
Peter T

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

So Should the new code look like this:


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

Private Sub CommandButton1_Click()
Dim nCol as long

If OptionButton1 = True Then
Range("cellname").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname").Column - 1).Formula =
TextBox1.Value
nCol = Range("cellname").Column
Worksheets("CGS").Cells(10, Range("cellname").Column - 1).Value =
CDbl(Calendar1.Value)
Else
Range("cellname2").EntireColumn.Insert
Worksheets("CGS").Cells(11, Range("cellname2").Column - 1).Formula =
TextBox1.Value
nCol = Range("cellname2").Column
Worksheets("CGS").Cells(10, Range("cellname2").Column - 1).Value =
CDbl(Calendar1.Value)
End If

Cells(10,nCol).value = textbox2.text

Unload Me
End Sub

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


I have no idea how this code should be written.

Please help me get this code written up correctly.

Thank you for your support


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile:

http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=468385



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
Modify Toolbar Button Styles saminam Excel Discussion (Misc queries) 1 July 14th 07 01:56 AM
How do I reset the Modify button for ribbon ken New Users to Excel 1 May 6th 07 09:41 PM
How to modify toolbar button in excel? Reed Excel Discussion (Misc queries) 0 March 28th 07 02:08 AM
How to modify toolbar button in excel? JLatham Excel Discussion (Misc queries) 0 March 28th 07 12:55 AM
Macro Button To Modify A Cell's Contents? Virtanis Excel Programming 10 February 27th 04 08:51 PM


All times are GMT +1. The time now is 01:38 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"