Hi,

Sub CommandButton_Click()

Dim i As Long

For i = 1 To Range("K65000").End(xlUp).Row
    If Trim(Range("K" & i).Text) = Empty Then
        Range("L" & i).Cut
        Range("P" & i).Select
        ActiveSheet.Paste
    End If
Next I

End Sub

On Saturday, January 10, 2015 at 2:00:54 PM UTC+5:30, Vabz wrote:

> Hi
>
> Try below code..
>
> Sub blah()
> Dim fRow As Range, lRow As Range, rRange As Range
> Dim c As Range
> Set fRow = Range("K2")
> Set lRow = Range("K" & Rows.Count).End(3)
> Debug.Print lRow.Row
> Set rRange = Range(fRow.Address & ":" & lRow.Address)
> Debug.Print rRange.Address
> For Each c In rRange
> If IsEmpty(c) Then
> c.Offset(0, 5).Value = c.Offset(0, 1).Value
> c.Offset(0, 1).Value = ""
> End If
> Next
> End Sub
>
> Cheers!!
>
> On Thu, Jan 8, 2015 at 11:15 PM, JenIT <jen...@alliedstaffing.com 
> <javascript:>> wrote:
>
>> I have a macro I am working on.  I have found a way do the find, cut and 
>> paste, but it does not loop,  It stops after it does the find, cut and 
>> paste one time. 
>>
>> When there are blanks in K there will be data data sitting in L that 
>> needs to be moved to P.  I 
>>
>>
>>
>> KLM NOP123  main streetSEDALIAMO65301999-111-222219.985.23
>>
>> Below is the code I used to find a blank K to then cut L to paste in P, 
>> but it only works for the first line.  I need it to loop through a variable 
>> length sheet.  A column that will be full until the end of the sheet if 
>> needed to reference an end is column C.  
>>
>> Range("K:K").Select
>>  Selection.SpecialCells(xlCellTypeBlanks).Select
>> ActiveCell.Offset(0, 1).Select
>>     Selection.Cut
>>     ActiveCell.Offset(0, 4).Select
>>     ActiveSheet.Paste
>>
>>
>>
>>
>>  -- 
>> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
>> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
>> https://www.facebook.com/discussexcel
>>  
>> FORUM RULES
>>  
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please 
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
>> will not get quick attention or may not be answered.
>> 2) Don't post a question in the thread of another member.
>> 3) Don't post questions regarding breaking or bypassing any security 
>> measure.
>> 4) Acknowledge the responses you receive, good or bad.
>> 5) Jobs posting is not allowed.
>> 6) Sharing copyrighted material and their links is not allowed.
>>  
>> NOTE : Don't ever post confidential data in a workbook. Forum owners and 
>> members are not responsible for any loss.
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "MS EXCEL AND VBA MACROS" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to excel-macros...@googlegroups.com <javascript:>.
>> To post to this group, send email to excel-...@googlegroups.com 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/excel-macros.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to