Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you can do something with this:
Option Explicit Sub testme() Dim FCell As Range Dim destCell As Range With ActiveSheet.Columns(1) Set FCell = .Find(what:="31", after:=.Cells(1), _ LookIn:=xlValues, lookat:=xlWhole, _ searchdirection:=xlPrevious, _ MatchCase:=False, searchorder:=xlByRows) End With If FCell Is Nothing Then MsgBox "not found" Else If IsEmpty(FCell.Offset(1, 0)) Then Set destCell = FCell.Offset(1, 0) Else Set destCell = FCell.End(xlDown).Offset(1, 0) End If 'do what you want to destcell destCell.Value = "whatever" End If End Sub David W wrote: Got a little problem, got this one pieced together with 1 glitch It does what it says, but I need it to go to the last number in that search(the way the sheet is laid out is when there is a entry, it puts the index number from the combobox each time, anotherwords (lets use 31 as the combobox's selected value) if you have got 12 entries, there will be 12 "31's" "in column A", I need to go to the next empty cell after the last "31" and insert the values from the boxes being used in this form. Keep in mind that this maybe in the middle of the sheet between existing records where there will be other numbers in the same column but, not the same number(the column start from the smallest to the biggest top to bottom Private Sub CommandButton2_Click() Dim Fcell As Range Set Fcell = Columns(1).Find(ComboBox1, lookat:=xlWhole) If Fcell = ComboBox1.value Then Sheets("kenjan").Unprotect ("?") Fcell.Select ActiveCell.Next.Select ActiveCell.Offset(1, 0) = ComboBox1.value ActiveCell.Offset(1, 3) = TextBox1.value ActiveCell.Offset(1, 5) = TextBox1.value ActiveCell.Offset(1, 7) = TextBox1.value ActiveCell.Offset(1, 9) = Val(Me.TextBox3.value) - Val(Me.TextBox2.value) TextBox1.value = "" TextBox2.value = "" TextBox3.value = "" End If End Sub -- Dave Peterson |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ended up doing this
for this to work right there has to be 2 of the numbers in column 1 or it will not work (they can be hidden) if not it will go to the next report thanks for trying Private Sub CommandButton2_Click() Dim Fcell As Range Set Fcell = Columns(1).Find(ComboBox1, lookat:=xlWhole) If Fcell = ComboBox1.value Then Sheets("kenjan").Unprotect ("?") Fcell.Select Selection.End(xlDown).Select ActiveCell.Offset(1) = ComboBox1.value ActiveCell.Offset(1, 2) = TextBox1.value ActiveCell.Offset(1, 4) = TextBox2.value ActiveCell.Offset(1, 6) = TextBox3.value ActiveCell.Offset(1, 8) = Val(Me.TextBox3.value) - Val(Me.TextBox2.value) TextBox1.value = "" TextBox2.value = "" TextBox3.value = "" Range("A1").Show End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options | Excel Discussion (Misc queries) | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing | Excel Discussion (Misc queries) | |||
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 | Excel Worksheet Functions | |||
How to create/run "cell A equals Cell B put Cell C info in Cell D | Excel Discussion (Misc queries) | |||
Question: Cell formula or macro to write result of one cell to another cell | Excel Programming |