Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Inserting a Row after finding a Name in colum

I am having a problem inserting a Row into a Colum with Names, the Colum also
has empty Cells, I have to find Name and then insert a row over the Name
before continuing.
I am using the visuel Basic with excel 2007

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Inserting a Row after finding a Name in colum

See if the following example helps.

Sub Macro1()

Dim rngColumn As Range
Dim foundCell As Range
Dim findWhat As String

With Sheets("Sheet1")
Set rngColumn = .Columns("C")
End With

'InputBox to get the value to find
findWhat = InputBox("enter name to find")

'You may need to alter the parameters
'in the Find depending on your needs.
'Example xlPart only has to have the
'required value somewhere in the cell
'whereas xlWhole, the entire cell must
'match the required value exactly.

Set foundCell = rngColumn.Find(What:=findWhat, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

If Not foundCell Is Nothing Then
foundCell.EntireRow.Insert
End If

End Sub
--
Regards,

OssieMac


"Dunomuch" wrote:

I am having a problem inserting a Row into a Colum with Names, the Colum also
has empty Cells, I have to find Name and then insert a row over the Name
before continuing.
I am using the visuel Basic with excel 2007

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Inserting a Row after finding a Name in colum



"OssieMac" wrote:

See if the following example helps.

Sub Macro1()

Dim rngColumn As Range
Dim foundCell As Range
Dim findWhat As String

With Sheets("Sheet1")
Set rngColumn = .Columns("C")
End With

'InputBox to get the value to find
findWhat = InputBox("enter name to find")

'You may need to alter the parameters
'in the Find depending on your needs.
'Example xlPart only has to have the
'required value somewhere in the cell
'whereas xlWhole, the entire cell must
'match the required value exactly.

Set foundCell = rngColumn.Find(What:=findWhat, _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False)

If Not foundCell Is Nothing Then
foundCell.EntireRow.Insert
End If

End Sub
--
Regards,

OssieMac


"Dunomuch" wrote:

I am having a problem inserting a Row into a Colum with Names, the Colum also
has empty Cells, I have to find Name and then insert a row over the Name
before continuing.
I am using the visuel Basic with excel 2007

Thanks thanks for the answer , im afraid i did not give a precise question, in Column A i have about 380 names with empty cells inbetween from a SAP list, with other data in 2 other Columns, B and C in Column A the only value in all Names is "," and the empty has to be directly over the Name so that i can later build a Table by i think transponding??

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
formular for finding data and inserting value in seperate column Frabj Excel Discussion (Misc queries) 2 November 28th 08 08:03 PM
Keeping a sum colum correct after inserting a colum of data in fro hazel Excel Discussion (Misc queries) 3 October 19th 05 09:51 PM
Finding the minimum in a selected number of rows of the same colum Mark Rugers Excel Worksheet Functions 5 July 20th 05 10:37 PM
Finding a Value and inserting a value in another cell Craig Excel Worksheet Functions 1 June 16th 05 09:39 PM
Help finding colum with VBA Jennifer Excel Programming 1 January 3rd 05 11:18 PM


All times are GMT +1. The time now is 10:24 AM.

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"