#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default next cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default next cell

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
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
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Populate a cell if values in cell 1 and cell 2 match cell 3 and 4 [email protected] Excel Worksheet Functions 1 August 22nd 08 02:04 AM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
Question: Cell formula or macro to write result of one cell to another cell Frederik Romanov Excel Programming 1 July 8th 03 03:03 PM


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