Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy/Paste Excel Macro

Hello,

What I'm trying to do is automate a process using an excel macro. What
I need the macro to do is to look for a blank cell in a range of data
in Column A, and whenever there is a blank space within that range,
paste some specific above information into this row. (I'm formatting
an excel file after taking it from another program). I would greatly
appreciate any help!

Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Copy/Paste Excel Macro

You could record a macro to filter on blank in coloum A then paste a formula
+cell above- this would then fill in your blanks
--
Thanks for your help


"Justin" wrote:

Hello,

What I'm trying to do is automate a process using an excel macro. What
I need the macro to do is to look for a blank cell in a range of data
in Column A, and whenever there is a blank space within that range,
paste some specific above information into this row. (I'm formatting
an excel file after taking it from another program). I would greatly
appreciate any help!

Thank you!
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Copy/Paste Excel Macro

Sub Fill_Blanks()
'by Dave Peterson 2004-01-06
'fill blank cells in column with value above
Dim wks As Worksheet
Dim Rng As Range
Dim LastRow As Long
Dim Col As Long

Set wks = ActiveSheet
With wks
Col = .Range("A1").column
'or
'Col = ActiveCell.Column

Set Rng = .UsedRange 'try to reset the lastcell
LastRow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set Rng = Nothing
On Error Resume Next
Set Rng = .Range(.Cells(2, Col), .Cells(LastRow, Col)) _
.Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If Rng Is Nothing Then
MsgBox "No blanks found"
Exit Sub
Else
Rng.NumberFormat = "General"
Rng.FormulaR1C1 = "=R[-1]C"
End If

'replace formulas with values
With .Cells(1, Col).EntireColumn
.Value = .Value
End With

End With

End Sub


Gord Dibben MS Excel MVP

On Thu, 7 Jan 2010 12:43:16 -0800 (PST), Justin wrote:

Hello,

What I'm trying to do is automate a process using an excel macro. What
I need the macro to do is to look for a blank cell in a range of data
in Column A, and whenever there is a blank space within that range,
paste some specific above information into this row. (I'm formatting
an excel file after taking it from another program). I would greatly
appreciate any help!

Thank you!


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Copy/Paste Excel Macro

Your description of the problem is too vague for suggesting code that will
do the job. But here is a sample that would do some of what you describe:

Sub fillBlanks()
Dim lr As Long, rng As Range
Dim sh As Worksheet, c As Range
Set sh = ActiveSheet
lr = sh.Cells(Rows.Count, 1).End(xlUp).Row
Set rng = sh.Range("A1:A" & lr)
For Each c In rng
If c.Row < 1 Then
If c.Value = "" And c.Offset(-1, 0) "" Then
c.Value = c.Offset(-1, 0).Value
End If
End If
Next
End Sub



"Justin" wrote in message
...
Hello,

What I'm trying to do is automate a process using an excel macro. What
I need the macro to do is to look for a blank cell in a range of data
in Column A, and whenever there is a blank space within that range,
paste some specific above information into this row. (I'm formatting
an excel file after taking it from another program). I would greatly
appreciate any help!

Thank you!



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Copy/Paste Excel Macro

THANK YOU SO MUCH!! THIS GREATLY HELPED ME AT WORK! With a little
modification, I was able to get it to copy all the cells I need in
just one macro!

THANKS AGAIN!
-JUSTIN
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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro Steven Excel Programming 1 October 17th 05 08:56 AM
Copy and paste from ie to excel using macro Larry Sartoris Excel Programming 2 August 15th 05 06:43 PM
Copy/Paste From Excel To Word Macro Kris Taylor[_2_] Excel Programming 15 July 26th 04 02:27 PM


All times are GMT +1. The time now is 02:48 AM.

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"