ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting Data Beneath Current Rows (https://www.excelbanter.com/excel-programming/323658-inserting-data-beneath-current-rows.html)

Jasper

Inserting Data Beneath Current Rows
 
For a fill in aplication I copy something from acces by hand and then use a
macro to fill it in the right sheet in the right format. For the fact that
the new data has to be filled in beneath the rows which are already there I
use the following macro rule:

Range("a2").End(xlDown).Offset(1, 0).Select

In the following group of rules:

Windows("Kostenbeheerssysteem Vorm I 15 februari 2005.xls").Activate
ActiveSheet.Paste
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Cells.EntireColumn.AutoFit
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("K:K").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
End Sub

Though I can seem to get it working. Could anyone show me what I am doing
wrong? Thanks in Advance!

Tom Ogilvy

Inserting Data Beneath Current Rows
 
Range("A2") would refer to the activesheet.

It is unclear what doesn't work and what your question is. Your group of
rules should work as that is recorded code. Your code to find the next
empty row should work as long as A3 is not blank. So possibilities include
having the wrong sheet active when you run the first line of code.

--
Regards,
Tom Ogilvy

"Jasper" wrote in message
...
For a fill in aplication I copy something from acces by hand and then use

a
macro to fill it in the right sheet in the right format. For the fact that
the new data has to be filled in beneath the rows which are already there

I
use the following macro rule:

Range("a2").End(xlDown).Offset(1, 0).Select

In the following group of rules:

Windows("Kostenbeheerssysteem Vorm I 15 februari 2005.xls").Activate
ActiveSheet.Paste
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Cells.EntireColumn.AutoFit
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("K:K").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
End Sub

Though I can seem to get it working. Could anyone show me what I am doing
wrong? Thanks in Advance!




Jasper

Inserting Data Beneath Current Rows
 
Sorry. The question was: "How can I fill in the data, using the code below as
a basis, to fill in new data in the cell beneath the allready shown data?
Thanks!

Windows("Kostenbeheerssysteem Vorm I 15 februari 2005.xls").Activate
ActiveSheet.Paste
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Cells.EntireColumn.AutoFit
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("K:K").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
End Sub


Tom Ogilvy

Inserting Data Beneath Current Rows
 
Windows("Kostenbeheerssysteem Vorm I 15 februari 2005.xls").Activate
ActiveSheet.Paste
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
set rng = .cells(rows.count,1).End(xlup)(2)
' then
rng.Value = "New Data"
'or
Something.copy Destination:= rng

--
Regards,
Tom Ogilvy



"Jasper" wrote in message
...
Sorry. The question was: "How can I fill in the data, using the code below

as
a basis, to fill in new data in the cell beneath the allready shown data?
Thanks!

Windows("Kostenbeheerssysteem Vorm I 15 februari 2005.xls").Activate
ActiveSheet.Paste
Cells.Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlTop
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Cells.EntireColumn.AutoFit
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Columns("K:K").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
End Sub





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com