LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro To Insert Row And Add Data.


A forum user (GER) kindly wrote this macro for me yesterday to find the
cell that holds the text "homeDirectory:" , insert a row above the cell
and insert the text "replace: homeDirectory" into the new row (in the
first column).

I was hoping someone could alter this code for me to produce a new
macro which finds any cells that hold the text "homeDirectory:
\\server1" and inserts a row below the cell and inserts a hyphen "-" in
the first column of the new row.

The data is from an active directory export and only populates 1
column, however the column has 5000 rows.

=================================

Public Sub test()

Dim C As Variant
Dim FirstRow As Integer

With Worksheets(1).Range("a1:a5500")
Set C = .Find("homeDirectory:", LookIn:=xlValues)
If Not C Is Nothing Then
FirstRow = C.Row + 1
Do
C.Insert Shift:=xlDown
C.Offset(-1, 0).Value = "replace: homeDirectory"
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Row < FirstRow
End If
End With


End Sub

======================


Thanks for any help

Andy


--
quinla01
------------------------------------------------------------------------
quinla01's Profile: http://www.excelforum.com/member.php...o&userid=31583
View this thread: http://www.excelforum.com/showthread...hreadid=513152

 
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
Invoking macro to insert rows according to DDE imported data chainastole New Users to Excel 1 June 2nd 07 01:49 AM
Macro: Insert, copy and past data from sheet Metaldream7 Excel Discussion (Misc queries) 0 November 8th 06 09:31 PM
Macro To Find Data And Insert Row quinla01 Excel Programming 2 February 15th 06 04:18 PM
Embedding an "insert row" macro with data validation Mr. G. Excel Worksheet Functions 0 April 11th 05 06:09 AM
Macro To insert missing data lshavit[_2_] Excel Programming 0 October 29th 04 01:35 PM


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