Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Excel Macro Basic Help

I have never written Excel macros or written in Visual
Basic before. I am trying to write a macro that will
organize my spreadsheet into a certain order. In order
to do that, I need to be able to search for a row that
has a 0 in the first column cut that row to the beginning
of my file. Here is what I have, but it isn't working.

For n = 2 To FinalRow
If (Range("A" & n).Value) = 0 Then
Rows("n:n").Select
Selection.Cut
Rows("2:2").Select
Selection.Insert Shift:=xlDown
End If
Next n

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel Macro Basic Help

Adam,

Just adapting your code

For n = 2 To FinalRow
If (Range("A" & n).Value) = 0 Then
Rows(n & ":" & n).Cut
Rows("2:2").Insert Shift:=xlDown
End If
Next n

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Adam" wrote in message
...
I have never written Excel macros or written in Visual
Basic before. I am trying to write a macro that will
organize my spreadsheet into a certain order. In order
to do that, I need to be able to search for a row that
has a 0 in the first column cut that row to the beginning
of my file. Here is what I have, but it isn't working.

For n = 2 To FinalRow
If (Range("A" & n).Value) = 0 Then
Rows("n:n").Select
Selection.Cut
Rows("2:2").Select
Selection.Insert Shift:=xlDown
End If
Next n

Thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel Macro Basic Help

Sorting your data doesn't do what you want?

--
Regards,
Tom Ogilvy

"Adam" wrote in message
...
I have never written Excel macros or written in Visual
Basic before. I am trying to write a macro that will
organize my spreadsheet into a certain order. In order
to do that, I need to be able to search for a row that
has a 0 in the first column cut that row to the beginning
of my file. Here is what I have, but it isn't working.

For n = 2 To FinalRow
If (Range("A" & n).Value) = 0 Then
Rows("n:n").Select
Selection.Cut
Rows("2:2").Select
Selection.Insert Shift:=xlDown
End If
Next n

Thank you



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
Set up basic Macro in EXcel to use in other applications Excel recorded macros used in other appl Excel Discussion (Misc queries) 0 August 31st 05 01:32 PM
Visual Basic/ Macro date formatting in Excel 97 Frank[_19_] Excel Programming 3 April 13th 04 11:04 AM
Visual Basic macro to do something that is done trhough an Excel function Thierry[_2_] Excel Programming 2 December 11th 03 08:58 AM
visual basic macro in excel Patrick Molloy[_9_] Excel Programming 0 July 23rd 03 09:12 AM
visual basic macro in excel Patrick Molloy Excel Programming 0 July 23rd 03 07:49 AM


All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"