Thread: Insert Contents
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Insert Contents

Glad to help

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sal" wrote in message
...
Perfect! Thank you.

"Don Guillett" wrote:

Sub Insertcontents()
For i = 2 To Cells(Rows.Count, "k").End(xlUp).Row
If Len(Application.Trim(Cells(i, "i"))) < 1 Then Cells(i, "i") = 4
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sal" wrote in message
...
Sub Insertcontents()

Range("I2:I" & Range("K" & Rows.Count).End(xlUp).Row).Formula = "04"

End Sub


I am using this macro to fill in blank cells in Column I with 04,
depending
on whether Column K has contents in it. The problem I am having is that
cells
in Column I which already have contents are being changed to 04 when I
only
want the blank cells in Column I to be changed to 04.

I would like to adjust this macro so that if the cells in Column I are
blank
they will be changed to 04, however if they already have contents in
them
those contents will not be changed to 04. My target is to get both
actions
to depend on whether Column K has contents in it. If Column K has
contents
activate, if it does not, do not activate. Any help I appreciate.