Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Esrei
 
Posts: n/a
Default Macro to copy value in empty cells

I have a macro that insert a line every time the value in C changes. Now I
want to add that it must put in the new row in A the text that is in C in
the row just under this row.
So This would be like a heading.
Hope I am not too fuzzy.
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Esrei,

Post your old code.

HTH,
Bernie
MS Excel MVP


"Esrei" wrote in message
...
I have a macro that insert a line every time the value in C changes. Now I
want to add that it must put in the new row in A the text that is in C in
the row just under this row.
So This would be like a heading.
Hope I am not too fuzzy.



  #3   Report Post  
Esrei
 
Posts: n/a
Default

Bit of a long one working on a priclist to be coppied and made presentable
from a DB.

Sheets("Prys berekening").Select
Range("A1:N1").Copy
Sheets("Cust price list").Select
Range("A16").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Prys berekening").Select
Range("A2:N311").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Cust price list").Select
Range("A17").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range("B:B,D:E,G:G,N:N").Delete Shift:=xlToLeft
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For row_index = lastrow - 1 To 2 Step -1
If Cells(row_index, "D").Value < _
Cells(row_index + 1, "D").Value Then
Cells(row_index + 1, "D").EntireRow.Insert _
(xlShiftDown)
End If
Next
End Sub
"Bernie Deitrick" wrote:

Esrei,

Post your old code.

HTH,
Bernie
MS Excel MVP


"Esrei" wrote in message
...
I have a macro that insert a line every time the value in C changes. Now I
want to add that it must put in the new row in A the text that is in C in
the row just under this row.
So This would be like a heading.
Hope I am not too fuzzy.




  #4   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Esrei,

Change

For row_index = lastrow - 1 To 2 Step -1
If Cells(row_index, "D").Value < _
Cells(row_index + 1, "D").Value Then
Cells(row_index + 1, "D").EntireRow.Insert _
(xlShiftDown)
End If

To:

For row_index = lastrow - 1 To 2 Step -1
If Cells(row_index, "D").Value < _
Cells(row_index + 1, "D").Value Then
Cells(row_index + 1, "D").EntireRow.Insert _
(xlShiftDown)
Cells(row_index+1,1).Value = Cells(row_index +2,3).Value
End If

HTH,
Bernie
MS Excel MVP


"Esrei" wrote in message
...
Bit of a long one working on a priclist to be coppied and made presentable
from a DB.

Sheets("Prys berekening").Select
Range("A1:N1").Copy
Sheets("Cust price list").Select
Range("A16").PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Sheets("Prys berekening").Select
Range("A2:N311").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Cust price list").Select
Range("A17").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
Range("B:B,D:E,G:G,N:N").Delete Shift:=xlToLeft
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).row
For row_index = lastrow - 1 To 2 Step -1
If Cells(row_index, "D").Value < _
Cells(row_index + 1, "D").Value Then
Cells(row_index + 1, "D").EntireRow.Insert _
(xlShiftDown)
End If
Next
End Sub
"Bernie Deitrick" wrote:

Esrei,

Post your old code.

HTH,
Bernie
MS Excel MVP


"Esrei" wrote in message
...
I have a macro that insert a line every time the value in C changes.

Now I
want to add that it must put in the new row in A the text that is in

C in
the row just under this row.
So This would be like a heading.
Hope I am not too fuzzy.






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
Copy down - special to fill only the blank cells Mike Excel Discussion (Misc queries) 3 April 18th 05 10:08 PM
copy visble cells at the subtotal level jfkosu Excel Worksheet Functions 2 March 31st 05 01:57 AM
Activate a macro to insert a row and copy the formuals from the rows above to the blank row oil_driller Excel Discussion (Misc queries) 1 February 11th 05 03:30 PM
Reporting of Empty Cells Dennis Excel Worksheet Functions 5 January 2nd 05 10:26 AM
Macro to hide rows with empty cells tp58tp Excel Worksheet Functions 2 November 13th 04 02:01 PM


All times are GMT +1. The time now is 08:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"