Asking Help for VBA copy only cell eith value and the cell before

ericokay

New Member
Joined
Feb 22, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Please anybody help me to solve this VBA

I want to copy a range that if the specified cell is filled with value

in the picture attached is my file
if G9 is filled with value more than 0 then i want to copy from B9 to G9
i need only the code to select the range. i alrewdy have the copy code to another sheet


PSX_20220223_104338.jpg

thank you so much all
 
Last edited by a moderator:

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try If Range("G9") > 0 Then Range("B9:G9").Copy or
If Range("G9") > 0 Then
Range("B9:G9").Copy
End If

You might have to further qualify the Range reference by providing a reference to a particular sheet (or ActiveSheet).
 
Upvote 0

Forum statistics

Threads
1,215,208
Messages
6,123,644
Members
449,111
Latest member
ghennedy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top