Hi All
i have a simple spreedsheet setup for my daily work priority list.
you enter data on sheet1 (Data Entry) hit submit and it goes to Sheet 2(DataBase)
this then has a custom sort macro which runs to organise
this (i think) is the code that pastes in the next blank row
my issue is when i started it was working fine, it would paste to the next empty row in my table. but now its pasting to the next empty row below my table instead.
i have a simple spreedsheet setup for my daily work priority list.
you enter data on sheet1 (Data Entry) hit submit and it goes to Sheet 2(DataBase)
VBA Code:
Private Sub CmbSubmit_Click()
Dim srcSht As Worksheet, destSht As Worksheet
Dim srcRng As Range, destRng As Range
Set srcSht = Worksheets("Data Entry")
Set destSht = Worksheets("Database")
With destSht
Set destRng = .Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
With srcSht
Set srcRng = .Range("B1:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
End With
srcRng.Copy
destRng.PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
Call Macro3
Range("B1").Clear
Range("B3", "B5").Clear
End Sub
this then has a custom sort macro which runs to organise
VBA Code:
Sub Macro3()
'
' Macro3 Macro
'
' Keyboard Shortcut: Ctrl+p
'
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields.Add _
(Range("Table2[Status]"), xlSortOnFontColor, xlAscending, , xlSortNormal). _
SortOnValue.Color = RGB(255, 192, 0)
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields.Add _
(Range("Table2[Status]"), xlSortOnFontColor, xlAscending, , xlSortNormal). _
SortOnValue.Color = RGB(255, 0, 0)
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields.Add _
(Range("Table2[Status]"), xlSortOnFontColor, xlAscending, , xlSortNormal). _
SortOnValue.Color = RGB(112, 173, 71)
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields.Add _
(Range("Table2[Priority]"), xlSortOnFontColor, xlAscending, , xlSortNormal). _
SortOnValue.Color = RGB(255, 0, 0)
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields.Add _
(Range("Table2[Priority]"), xlSortOnFontColor, xlAscending, , xlSortNormal). _
SortOnValue.Color = RGB(255, 192, 0)
ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort.SortFields.Add _
(Range("Table2[Priority]"), xlSortOnFontColor, xlAscending, , xlSortNormal). _
SortOnValue.Color = RGB(112, 173, 71)
With ActiveWorkbook.Worksheets("Database").ListObjects("Table2").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
this (i think) is the code that pastes in the next blank row
VBA Code:
Sub LaptopRegisterTranspose()
Dim srcSht As Worksheet, destSht As Worksheet
Dim srcRng As Range, destRng As Range
Set srcSht = Worksheets("Data Entry")
Set destSht = Worksheets("Database")
With destSht
Set destRng = .Range("A" & Rows.Count).End(xlUp).Offset(1)
End With
With srcSht
Set srcRng = .Range("B1:B" & .Cells(Rows.Count, "B").End(xlUp).Row)
End With
srcRng.Copy
destRng.PasteSpecial Paste:=xlPasteValues, Transpose:=True
Application.CutCopyMode = False
End Sub
my issue is when i started it was working fine, it would paste to the next empty row in my table. but now its pasting to the next empty row below my table instead.