Date: 13/06/2018 13:18:15
From: mollwollfumble
ID: 1239112
Subject: Excel question

I’m back on Excel, so may have a few Excel questions of the next couple of weeks.

The first is:

How do I insert a blank row before every row that contains 9999 in column D?

Reply Quote

Date: 13/06/2018 13:22:33
From: The Rev Dodgson
ID: 1239118
Subject: re: Excel question

mollwollfumble said:


I’m back on Excel, so may have a few Excel questions of the next couple of weeks.

The first is:

How do I insert a blank row before every row that contains 9999 in column D?

Happy with VBA?

I don’t think there is any way to do it without.

Reply Quote

Date: 13/06/2018 13:26:47
From: mollwollfumble
ID: 1239120
Subject: re: Excel question

The Rev Dodgson said:


mollwollfumble said:

I’m back on Excel, so may have a few Excel questions of the next couple of weeks.

The first is:

How do I insert a blank row before every row that contains 9999 in column D?

Happy with VBA?

I don’t think there is any way to do it without.

Very Happy. Fingers crossed.

Reply Quote

Date: 13/06/2018 13:41:59
From: mollwollfumble
ID: 1239132
Subject: re: Excel question

Okay. VBA editor is open. What do I do now?

Reply Quote

Date: 13/06/2018 13:45:40
From: Cymek
ID: 1239134
Subject: re: Excel question

mollwollfumble said:


Okay. VBA editor is open. What do I do now?

Alt f4

Reply Quote

Date: 13/06/2018 14:06:26
From: The Rev Dodgson
ID: 1239144
Subject: re: Excel question

mollwollfumble said:


Okay. VBA editor is open. What do I do now?

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

Reply Quote

Date: 13/06/2018 14:13:51
From: The Rev Dodgson
ID: 1239148
Subject: re: Excel question

The Rev Dodgson said:

mollwollfumble said:


Okay. VBA editor is open. What do I do now?

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

This editor messes up code.
Should be a new line after each “Then”, and for each new statement.

I can e-mail a file if you can’t get it to work.

Reply Quote

Date: 13/06/2018 14:16:32
From: Peak Warming Man
ID: 1239149
Subject: re: Excel question

The Rev Dodgson said:


The Rev Dodgson said:

mollwollfumble said:


Okay. VBA editor is open. What do I do now?

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

This editor messes up code.
Should be a new line after each “Then”, and for each new statement.

I can e-mail a file if you can’t get it to work.

Don’t ever leave.

Reply Quote

Date: 13/06/2018 14:30:56
From: mollwollfumble
ID: 1239158
Subject: re: Excel question

The Rev Dodgson said:


mollwollfumble said:

Okay. VBA editor is open. What do I do now?

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

I was able to click “quote” here to get the original text you typed.

Worked perfectly. Six worksheets with about 6000 newlines on each.

And beautifully simple compared to some VBA code on the web.

Reply Quote

Date: 13/06/2018 14:35:10
From: The Rev Dodgson
ID: 1239160
Subject: re: Excel question

mollwollfumble said:


The Rev Dodgson said:

mollwollfumble said:

Okay. VBA editor is open. What do I do now?

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

I was able to click “quote” here to get the original text you typed.

Worked perfectly. Six worksheets with about 6000 newlines on each.

And beautifully simple compared to some VBA code on the web.

Oh yeah, I forgot about clicking quote to see the original.

Glad it worked :)

Reply Quote

Date: 13/06/2018 15:19:31
From: sibeen
ID: 1239166
Subject: re: Excel question

Peak Warming Man said:


The Rev Dodgson said:

The Rev Dodgson said:

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

This editor messes up code.
Should be a new line after each “Then”, and for each new statement.

I can e-mail a file if you can’t get it to work.

Don’t ever leave.

+1

:)

Reply Quote

Date: 13/06/2018 15:21:28
From: mollwollfumble
ID: 1239169
Subject: re: Excel question

The Rev Dodgson said:


mollwollfumble said:

The Rev Dodgson said:

Insert a new module if you don’t have any.

Copy and paste:

Sub insrow()
Dim cell As Range, CheckNext As Boolean
CheckNext = True
For Each cell In ActiveSheet.Columns(4).Cells

If cell.Value = 9999 Then If CheckNext Then cell.EntireRow.Insert CheckNext = False Else CheckNext = True End If End If Next cell

End Sub

Press F5 from the editor, or go to the worksheet and press alt-F8 and select insrow.

I was able to click “quote” here to get the original text you typed.

Worked perfectly. Six worksheets with about 6000 newlines on each.

And beautifully simple compared to some VBA code on the web.

Oh yeah, I forgot about clicking quote to see the original.

Glad it worked :)


> 6000
Oops, that was 60,000 newlines on each. Not something I could do by hand. :)

The application is processing radiosonde data.

Reply Quote