Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Modify Toolbar Button Styles | Excel Discussion (Misc queries) | |||
How do I reset the Modify button for ribbon | New Users to Excel | |||
How to modify toolbar button in excel? | Excel Discussion (Misc queries) | |||
How to modify toolbar button in excel? | Excel Discussion (Misc queries) | |||
Macro Button To Modify A Cell's Contents? | Excel Programming |