I am exporting data from Access into Excel using VB. What I would like to do is after a certain record has been passed into Excel is to insert a blank line before the next record. Not sure how to do this.
Thanks,
gj0519
Just be careful using Insert and Delete when columns/rows/cells are SHIFTED.
Here's why. If you reference cells on that sheet, your references move. That may or may not be what you want to happen.
Ususlly, when "inserting" data, it is customary to "insert" at the BOTTOM of the table/list and then after all the "inserts" have been performed, SORT the data by the table keys.
I am able to insert a new row, where the cell is active.
I have 700 rows of data and it changes daily, I need to insert rows at specific places without having to manualy looking. Here is a small piece of my code where I am trying to do this.FISC is my column name with numbers up to 900. I am trying to tell it is when the last row with 700 is found, then insert a row after that record.
Thanks,
gj0519
Private Sub OrganizeForm_Click()
Dim FISC As Integer
If FISC < 700 Then
ActiveCell.EntireRow.Insert
End If
Private Sub CommandButton1_Click()
Dim lngValue As Long
Range("A1".Select 'active cell at column heading FISC
lngValue = 0
Do While lngValue <= 700
ActiveCell.Offset(1, 0).Select
lngValue = ActiveCell.Value
Loop
'activecell is now on the first row where value is bigger than 700
ActiveCell.EntireRow.Insert
End Sub
Thanks,
Still having some problems though. I have
Range("G4".select
and it inserts a row at G4, if I change the range value, it inserts a row at that point. Not sure what I am doing wrong.
gj0519
This is crazy, if I open an empty worksheet and enter in test data and change the code to look at Range("G1"I can get it to work. But when I try it with the real data it inserts a row after G1? Thanks a bunch for the help THogan.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.