![]() |
Insert Row Specified Sheet
i have 3 Checkboxes, If Checkbox 1 is Selected Then i need to Insert
a Row on That Sheet If 2 is Selected then i need Insert a row on that page If 3 is Selected then i would insert a row on that page. Here is what i have but i think im a bit far off.... Never Have done Much Programming in vba any help would be Greatly appreciated or Even a Shorter Row of doing this would be much appreciated.. Private Sub CmdCreate_Click() Dim Row As Integer Dim MyPage = Array("Sheet1","Sheet2","Sheet3") If CkBoxShelter.Value = False And CkBoxDep.Value = False And CkBoxTPR.Value = False Then MsgBox "Please Select The Type", vbOKOnly End If If CkBoxDep.Value = True Then MyPage(1).Activate End If If CkBoxTPR.Value = True Then MyPage(2).Activate End If ' Insert data into Excel. With excel_app .Rows("6:6").Select ' Insert Row Selection.Insert Shift:=xlDown Row = 6 Range("A" & Format$(Row)).Select ActiveCell.FormulaR1C1 = TxtCaseName.Text End With Unload Me FSearch.Show |
Insert Row Specified Sheet
from:
With excel_app .Rows("6:6").Select ' Insert Row Selection.Insert Shift:=xlDown Row = 6 Range("A" & Format$(Row)).Select ActiveCell.FormulaR1C1 = TxtCaseName.Text End With to: With Activesheet .Rows(6).Insert Row = 6 .Range("A" & Row).Formula = "=" & TxtCaseName.Text End With The above formula expect the string to be "A5" or equivalent. A R1C1 formula would look like this "R3C2". The is "B2" and the letter R and letter C would have to be part of the string. " wrote: i have 3 Checkboxes, If Checkbox 1 is Selected Then i need to Insert a Row on That Sheet If 2 is Selected then i need Insert a row on that page If 3 is Selected then i would insert a row on that page. Here is what i have but i think im a bit far off.... Never Have done Much Programming in vba any help would be Greatly appreciated or Even a Shorter Row of doing this would be much appreciated.. Private Sub CmdCreate_Click() Dim Row As Integer Dim MyPage = Array("Sheet1","Sheet2","Sheet3") If CkBoxShelter.Value = False And CkBoxDep.Value = False And CkBoxTPR.Value = False Then MsgBox "Please Select The Type", vbOKOnly End If If CkBoxDep.Value = True Then MyPage(1).Activate End If If CkBoxTPR.Value = True Then MyPage(2).Activate End If ' Insert data into Excel. With excel_app .Rows("6:6").Select ' Insert Row Selection.Insert Shift:=xlDown Row = 6 Range("A" & Format$(Row)).Select ActiveCell.FormulaR1C1 = TxtCaseName.Text End With Unload Me FSearch.Show |
Insert Row Specified Sheet
On Oct 30, 11:36 am, Joel wrote:
from: With excel_app .Rows("6:6").Select ' Insert Row Selection.Insert Shift:=xlDown Row = 6 Range("A" & Format$(Row)).Select ActiveCell.FormulaR1C1 = TxtCaseName.Text End With to: With Activesheet .Rows(6).Insert Row = 6 .Range("A" & Row).Formula = "=" & TxtCaseName.Text End With The above formula expect the string to be "A5" or equivalent. A R1C1 formula would look like this "R3C2". The is "B2" and the letter R and letter C would have to be part of the string. " wrote: i have 3 Checkboxes, If Checkbox 1 is Selected Then i need to Insert a Row on That Sheet If 2 is Selected then i need Insert a row on that page If 3 is Selected then i would insert a row on that page. Here is what i have but i think im a bit far off.... Never Have done Much Programming in vba any help would be Greatly appreciated or Even a Shorter Row of doing this would be much appreciated.. Private Sub CmdCreate_Click() Dim Row As Integer Dim MyPage = Array("Sheet1","Sheet2","Sheet3") If CkBoxShelter.Value = False And CkBoxDep.Value = False And CkBoxTPR.Value = False Then MsgBox "Please Select The Type", vbOKOnly End If If CkBoxDep.Value = True Then MyPage(1).Activate End If If CkBoxTPR.Value = True Then MyPage(2).Activate End If ' Insert data into Excel. With excel_app .Rows("6:6").Select ' Insert Row Selection.Insert Shift:=xlDown Row = 6 Range("A" & Format$(Row)).Select ActiveCell.FormulaR1C1 = TxtCaseName.Text End With Unload Me FSearch.Show- Hide quoted text - - Show quoted text - Ty for The help I got it working. :) With ActiveSheet |
All times are GMT +1. The time now is 12:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com