Basic VBA code question and how to implant it - Excel 2013

2avrham

Board Regular
Joined
May 12, 2014
Messages
104
Office Version
  1. 365
Hi,

I usually record my macros and therefore I not really know how to use VBA code.

I have data file that include several rows that I don't need (quantity of the rows may changed from time to time).

see file example:

"
txtSelectedTimeSpan textbox8
Site: HVC Tester Type: CMT ,OLB ,Verigy

textbox12 textbox15 textbox21 textbox24 textbox30 textbox33 textbox36 textbox45 textbox46 textbox47 textbox48 textbox49
HVC CMT 93.75 76.84% 15.75 12.91% 4.5 3.69% 8 6.56% 0 0.00%
HVC Verigy 34.5 28.28% 43.75 35.86% 43.75 35.86% 0 0.00% 0 0.00%

textbox44 textbox4 textbox6 textbox11 textbox14 textbox17 textbox20 textbox23 textbox26 textbox29 textbox32 textbox35
CMT CMT0263 39.25 64.34% 10.5 17.21% 3.25 5.33% 8 13.11% 0 0.00%
CMT CMT0371 54.5 89.34% 5.25 8.61% 1.25 2.05% 0 0.00% 0 0.00%
Verigy ilv93k33 10.75 17.62% 38.5 63.11% 11.75 19.26% 0 0.00% 0 0.00%
Verigy ilv93k34 23.75 38.93% 5.25 8.61% 32 52.46% 0 0.00% 0 0.00%

textbox69 textbox70 textbox71 textbox72 textbox73 textbox74 textbox76
Feb 24 2015 1:00AM CMT CMT0263 UNDEFINED Down
Feb 24 2015 1:00AM Verigy ilv93k33 UNDEFINED Logged Out
Feb 24 2015 1:00AM DBELKIN Verigy ilv93k34 UNDEFINED Active
Feb 24 2015 1:00AM GDLUSER CMT CMT0371 alpineridge Tester Maintenance Active
Feb 24 2015 1:15AM CMT CMT0263 UNDEFINED Down

"

what im asking is how can I delete through code all row that above "textbox69" and cause to "textbox69" cell to be at cell A1 all the time.

in addition can I "install" this VBA code in PowerPivot? if yes how can I do it.

thanks a lot!!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Have a look at my signature block for some links on how to show screenshots.
In particular MrExcel HTML Maker or Excel Jeanie.


in addition can I "install" this VBA code in PowerPivot? if yes how can I do it.

I don't understand this question PowerPivot is an add-in, your macro's go in Excel.
 
Upvote 0
I will be more specific:

1. I need help to write VBA code that search for specific test "textbox69" and delete all rows above it.

2. my second question is if I can use this VBA code at PowerPivot table?
 
Upvote 0
I will be more specific:
I need help to write VBA code that search for specific test "textbox69" and delete all rows above it.

Not that specific...

Where is "textbox69" located? Column "A", Column "B", any Column?
Do you have a header row? If yes does this also get deleted?
 
Upvote 0
sorry...

"textbox69" always may be found at column A (row number is changing from time to time).

from my side all above data can be deleted including header.
 
Upvote 0
To delete rows above "textbox69" (with out the quotes and without blank spaces and any other text) in column A try the code below, test on a copy of your data because you are deleting then post back what you need to do with the powerpivot.

Rich (BB code):
Sub deletex()
    Dim x As Long
    x = Columns("A:A").Find(What:="textbox69", After:=Cells(1, 1), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows).Row - 1
    Rows("1:" & x).Delete
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,076
Messages
6,176,239
Members
452,715
Latest member
DebbieCox

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