#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Delete row

I am trying to run a macro or do some sort of VBA code which after it is
run, will delete every fifth row in my excel file. I have some 45700 rows in
my excel file, and I will take hours to delete these rows by hand. Please
help.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Delete row

Have a look he
http://www.mcgimpsey.com/excel/deleteeverynthrow.html
ABCD wrote:
I am trying to run a macro or do some sort of VBA code which after it is
run, will delete every fifth row in my excel file. I have some 45700 rows in
my excel file, and I will take hours to delete these rows by hand. Please
help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default UDF Not Calculating Properly

(Excel 2007, Windows XP)

I have a function which is giving me some grief. (Code below.) It's
supposed to search through a range of 10 cells, each of which is
individually named, and check to see if a string is there. (It gets the
value of the string from the Index function)
If that string is there, it takes a number from an adjacent cell, and
reports that as the function value.

Several identically formatted worksheets contain this function, and the
same named ranged (local names, created with the Name Manager add-in).

It works perfectly, for a while, but then at some point I notice the
function is reporting the wrong value: either a value from one of the
other sheets, or 0, or #Value.

I can't figure out why. Here's the function:

Function LoveDeity(rgReligion As Range, rgPassionNames As Range,
rgPassionScores As Range) As Integer
Dim ws As Worksheet, i As Integer
' the next line was added in a vain attempt to get it to work
' it seemed to work - for a while
'Application.Volatile True

' I've tried the function without the following line
' and removing the ws bits in the For Next loop below
' with no joy
Set ws = rgReligion.Worksheet
Dim strReligion As String
Dim strDeity As String
Dim strPassion As String
Dim strPassionScore As String
strReligion = rgReligion.Value
If strReligion = "" Then Exit Function
strDeity = RemoveBrackets(CheckReligiousTable(strReligion, "Deity"))
With ws
For i = 1 To 10
strPassion = .Range("Passion" & i).Value
strPassion = RemoveBrackets(strPassion)
If strPassion = strDeity Then
strPassionScore = "Passion" & i & "Value"
Exit For
End If
Next i
If strPassionScore = "" Then
LoveDeity = 0
Exit Function
End If
' this bit was put in to cut down on writes to the worksheet.
' "MyLoveDeity" is the cell that contains this UDF
' The problem occurs whether this line is included or not.
If .Range(strPassionScore).Value < .Range("MyLoveDeity").Value
Then
LoveDeity = .Range(strPassionScore).Value
End If
End With
' the next line was added in another vain attempt to get the UDF to work

' it seemed to work - for a while
Application.Calculate
End Function

Thanks in advance,

Darren.

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
Macro to delete sheets and saves remaining file does not properly delete module pherrero Excel Programming 0 June 21st 05 05:16 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Macro to delete sheets and saves remaining file does not properly delete module bhawane Excel Programming 0 June 21st 05 04:53 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


All times are GMT +1. The time now is 04:05 PM.

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"