ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   if cell has null value, move data from one cell to another (https://www.excelbanter.com/excel-programming/329500-if-cell-has-null-value-move-data-one-cell-another.html)

looped

if cell has null value, move data from one cell to another
 
I have Owner1, Owner2, Owner3, OwnerAddress

I want to query Owner3 and IF null (blank), move value of Owner2 to
OwnerAddress.

Is this enough info to give me a push in the right direction? I
understand functions can't move data? So I need to use some code
like:

Sub MyMacro1()
'
' MyMacro1 Macro
'

'
Range("I3").Select
Selection.Cut
Range("K3").Select
ActiveSheet.Paste
End Sub


Can someone help with a routine to look for null and if so execute
some code to move (cut and paste) values from one cell to another?




Jim Thomlinson[_3_]

if cell has null value, move data from one cell to another
 
Something like this?

Sub CopyAddress()
Dim rng As Range
Dim wks As Worksheet

Set wks = ActiveSheet
Set rng = wks.Range("K65535").End(xlUp)

Do While rng.Row 1
If rng.Offset(0, -1).Value = Empty Then
rng.Value = rng.Offset(0, -2).Value
rng.Offset(0, -2).Value = Empty
End If
Set rng = rng.Offset(-1, 0)
Loop
End Sub

HTH

"looped" wrote:

I have Owner1, Owner2, Owner3, OwnerAddress

I want to query Owner3 and IF null (blank), move value of Owner2 to
OwnerAddress.

Is this enough info to give me a push in the right direction? I
understand functions can't move data? So I need to use some code
like:

Sub MyMacro1()
'
' MyMacro1 Macro
'

'
Range("I3").Select
Selection.Cut
Range("K3").Select
ActiveSheet.Paste
End Sub


Can someone help with a routine to look for null and if so execute
some code to move (cut and paste) values from one cell to another?






All times are GMT +1. The time now is 10:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com